Compare commits

...

58 Commits
0.4.2 ... 0.5.0

Author SHA1 Message Date
Ian Coleman
4e59e7d6fc Release v0.5.0 2020-10-19 01:13:39 +00:00
Ian Coleman
8c3a56ec4f Add notes about card entropy 2020-10-19 00:01:33 +00:00
Ian Coleman
d31a0ad44b Hide/show split mnemonic cards 2020-10-18 23:17:24 +00:00
Ian Coleman
4566751b89 Fix nano test, keys are lowercase not uppercase 2020-10-18 23:04:21 +00:00
Ian Coleman
b386aaa06e Update combined libs 2020-10-18 22:46:51 +00:00
Ian Coleman
ef95b4bfad Revert npm-shrinkwrap.json 2020-10-18 22:33:24 +00:00
iancoleman
30e3d246d4 Merge pull request #434 from Joohansson/nanocurrency
Added support for NANO currency
2020-10-19 09:26:29 +11:00
iancoleman
647410b4a6 Merge branch 'master' into nanocurrency 2020-10-19 09:26:08 +11:00
iancoleman
4669c88c67 Merge pull request #441 from bytefly/master
Add TRX coin support
2020-10-19 09:12:43 +11:00
iancoleman
9e865b8e75 Merge pull request #446 from jsarenik/jsn/update-bootstrap-3
Update bootstrap to 3.4.1
2020-10-19 09:04:50 +11:00
iancoleman
08713ff9c2 Merge pull request #447 from jsarenik/jsn/dependabot
All dependabot updates in one PR
2020-10-19 09:04:12 +11:00
dependabot[bot]
ed52cda20d Bump lodash from 4.17.11 to 4.17.19 in /libs/stellar-util
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.11 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.11...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-14 09:52:00 +02:00
dependabot[bot]
8ce57f3c13 Bump elliptic from 6.4.1 to 6.5.3 in /libs/stellar-util
Bumps [elliptic](https://github.com/indutny/elliptic) from 6.4.1 to 6.5.3.
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](https://github.com/indutny/elliptic/compare/v6.4.1...v6.5.3)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-14 09:52:00 +02:00
dependabot[bot]
043717034b Bump acorn from 6.0.4 to 6.4.1 in /libs/stellar-util
Bumps [acorn](https://github.com/acornjs/acorn) from 6.0.4 to 6.4.1.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/6.0.4...6.4.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-14 09:52:00 +02:00
dependabot[bot]
eb100ec0e4 Bump jsrsasign from 8.0.12 to 8.0.19 in /libs/combined
Bumps [jsrsasign](https://github.com/kjur/jsrsasign) from 8.0.12 to 8.0.19.
- [Release notes](https://github.com/kjur/jsrsasign/releases)
- [Changelog](https://github.com/kjur/jsrsasign/blob/master/ChangeLog.txt)
- [Commits](https://github.com/kjur/jsrsasign/compare/8.0.12...8.0.19)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-14 09:52:00 +02:00
Jan Sarenik
5cbd174c18 Update bootstrap to 3.4.1
https://www.npmjs.com/advisories/891
2020-10-14 09:08:00 +02:00
iancoleman
75722c6d24 Merge pull request #445 from jsarenik/jsn/releases-link
src/index.html: Change link to latest standalone release
2020-10-14 15:55:42 +11:00
Jan Sarenik
7e75b98e1f src/index.html: Change link to latest standalone release 2020-10-07 15:14:47 +02:00
zr
47dbf58b6d Add testcase for TRX 2020-10-05 12:04:14 +08:00
iancoleman
42e00ef56a Merge pull request #442 from mvillalba/master
Add Binance Smart Chain (BSC) support
2020-10-02 11:25:17 +10:00
Ian Coleman
8dbf7d5837 Add dev_env_setup.sh 2020-10-01 23:55:21 +00:00
Ian Coleman
bf96267f89 Remove bias from entropy in base 6 and base 10 2020-10-01 23:44:38 +00:00
Martín Raúl Villalba
995bc58791 Add Binance Smart Chain (BSC) support 2020-09-25 12:27:50 -03:00
zr
d7125cda1d Modify to use uncompressed public key as keccak256 input for TRX 2020-09-18 15:28:56 +08:00
zr
b674c5710b Add TRX coin support 2020-09-10 17:40:56 +08:00
iancoleman
920f7aa078 Merge pull request #436 from conr2d/eosio-cleanup-dependencies
Clean up duplicated dependencies from eos-util
2020-09-07 11:14:19 +10:00
Jeeyong Um
5c6e875f2d Clean up duplicated dependencies from eos-util 2020-08-31 00:35:29 +09:00
Joohansson
e086305895 Added NANO currency 2020-08-26 11:57:58 +02:00
iancoleman
863eee8ed7 Merge pull request #433 from scribenetwork/master
Add Scribe support
2020-08-25 09:27:54 +10:00
scribenetwork
4729ecca04 Update tests.js 2020-08-19 06:22:14 +02:00
scribenetwork
fba7e98aea Update index.js 2020-08-12 02:58:56 +02:00
scribenetwork
95b306106f Update bitcoinjs-extensions.js 2020-08-12 02:52:46 +02:00
Ian Coleman
f32b24e380 Release v0.4.3 2020-05-11 10:03:18 +10:00
Ian Coleman
26767a2ce3 Add CranePay test 2020-05-11 09:43:35 +10:00
Ian Coleman
a748c4b5c6 Fix RSK tests 2020-05-11 09:43:21 +10:00
Ian Coleman
eaf7892872 Update bip39-libs with handshake and FIO libs 2020-05-11 09:17:48 +10:00
iancoleman
677d18f2e0 Merge pull request #422 from cryply/master
adding CRP support
2020-05-11 09:16:11 +10:00
iancoleman
f3051a6a9f Merge pull request #409 from bguiz/feat/rsk-network
feat: rsk network
2020-05-11 09:06:02 +10:00
iancoleman
bf528f65f4 Merge branch 'master' into feat/rsk-network 2020-05-11 09:05:32 +10:00
Shawn Arney
5699633538 Adding FIO -Foundation for Interwallet Operability 2020-05-11 08:43:55 +10:00
Shawn Arney
d1d8699fc4 Adding FIO -Foundation for Interwallet Operability
FIO - Foundation for Interwallet Operability.

https://fioprotocol.io
2020-05-11 08:43:55 +10:00
iancoleman
e284827677 Merge pull request #410 from MerkleBlock/handshake
libs: add handshake support
2020-05-11 08:34:35 +10:00
m0rpher
115eb45083 adding CRP support 2020-05-08 22:56:37 +02:00
iancoleman
0d78c2a120 Merge pull request #418 from jangchongchan20/master
Add Sugarchain testnet support
2020-04-29 08:26:37 +10:00
Jang Chongchan
7594405011 Add Sugarchain testnet support 2020-04-28 23:33:27 +09:00
iancoleman
d359fe64b2 Merge pull request #416 from Argoneum/argoneum
Add Argoneum (v1.4.1 or above)
2020-04-28 09:25:55 +10:00
Ian Coleman
1bf76fe32d last word is/contains a checksum
Closes #408
2020-04-27 10:47:31 +10:00
iancoleman
904e39748c Merge pull request #415 from jangchongchan20/master
Add Sugarchain support
2020-04-27 10:41:27 +10:00
Oleg Semyonov
46054e445e Add Argoneum (v1.4.1 or above) 2020-04-25 14:26:06 +03:00
Jang Chongchan
4958ea8009 Add Sugarchain support 2020-04-24 10:20:50 +09:00
Javed Khan
0e1fd95302 libs: add handshake support 2020-04-03 00:13:36 +05:30
bguiz
a823e5266c fix: calculate RSK addresses with EIP-155 compliant checksums 2020-03-10 17:08:16 +08:00
bguiz
b64fb35301 fix: define own libs.bitcoin.networks.rsk 2020-03-03 14:55:53 +08:00
iancoleman
54600393af Merge pull request #402 from you21979/fix-mona-bech32
fix bech32 prefix monacoin -> mona
2020-02-17 15:16:07 +11:00
iancoleman
ff2940e81e Merge pull request #403 from swtcca/master
add two networks: Jingtum and MOAC
2020-02-17 10:33:08 +11:00
Lospring Liu
f3101bd3f1 add test for networks Jingtum and MOAC 2020-02-15 16:17:04 -05:00
Lospring Liu
46a5338e42 add two networks: Jingtum and MOAC 2020-02-14 20:51:52 -05:00
yuki akiyama
c578337f0f fix bech32 prefix monacoin -> mona 2020-02-13 12:28:03 +09:00
24 changed files with 3494 additions and 8256 deletions

View File

@@ -1,3 +1,30 @@
# 0.5.0
* Remove bias from base 6 and base 10 entropy
* Add notes about card entropy
* Hide/show split mnemonic cards
* Fix link to standalone release file
* Add Scribe network
* Add Nano network
* Add TRX network
* Add Binance Smart Chain network
* Clean up dependencies for eos-util
* Update bootstrap to 3.4.1
* Bump library versions
# 0.4.3
* Add FIO - Foundation for Interwallet Operability
* Add Argoneum
* Add CranePay
* Add Jingtum network
* Add MOAC
* Update RSK network
* Add HandShake
* Add Sugarchain testnet
* Fix wording "is a checksum" / "contains a checksum"
* Fix bech32 prefix for monacoin
# 0.4.2
* Fix ethereum private key format

58
dev_env_setup.sh Executable file
View File

@@ -0,0 +1,58 @@
# this script is intended to be run in a VM
# running ubuntu 20.04 server
# from the root directory of this repo
echo "This script is intended to be run in a VM."
echo "It may do things to your OS that you don't want to be peristent."
echo "Please type virtualmachine to continue, or Ctrl-C to quit."
read passage
if [ "$passage" = "virtualmachine" ]; then
echo "Installing dev environment"
else
echo "Did not type virtualmachine, quitting with no changes applied"
exit
fi
# set up place for local binaries
mkdir $HOME/.bin
echo "export PATH=$PATH:$HOME/.bin" >> $HOME/.bashrc
source $HOME/.bashrc
# allow python3 to be run with python command
ln -s /usr/bin/python3 $HOME/.bin/python
# install firefox and other dependencies
sudo apt-get -y install firefox unzip openjdk-11-jre-headless xvfb libxi6 libgconf-2-4 make build-essential
# install chrome
curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add
sudo sh -c "echo \"deb https://dl.google.com/linux/chrome/deb/ stable main\" >> /etc/apt/sources.list.d/google-chrome.list"
sudo apt-get -y update
sudo apt-get -y install google-chrome-stable
# install nodejs for running tests
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash
# load nvm
source $HOME/.bashrc
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# install latest node
nvm install node
# install jasmine
cd tests
npm install --global jasmine
npm install selenium-webdriver
# install gecko webdriver for firefox
wget https://github.com/mozilla/geckodriver/releases/download/v0.27.0/geckodriver-v0.27.0-linux64.tar.gz --output-document=/tmp/geckodriver.tar.gz
tar -xf /tmp/geckodriver.tar.gz -C $HOME/.bin
# install chrome webdriver for chromium
wget https://chromedriver.storage.googleapis.com/85.0.4183.87/chromedriver_linux64.zip --output-document=/tmp/chromedriver.zip
unzip /tmp/chromedriver.zip -d $HOME/.bin
# to run tests
# cd tests
# Xvfb :1 -screen 1 1024x768x24 & export DISPLAY=:1.1
# BROWSER=firefox jasmine spec/tests.js
# BROWSER=chrome jasmine spec/tests.js

View File

@@ -80,6 +80,23 @@ module.exports.stellarUtil = {
},
}
/* nano-util */
let NanoBase = require('nanocurrency-web');
module.exports.nanoUtil = {
getKeypair: function (index, seed) {
const accounts = NanoBase.wallet.accounts(seed, index, index)
return {privKey: accounts[0].privateKey, pubKey: accounts[0].publicKey, address: accounts[0].address};
},
dummyNetwork: {
bip32: {public: 0, private: 0},
messagePrefix: '',
pubKeyHash: 0,
scriptHash: 0,
wif: 0,
},
}
/* unorm */
module.exports.unorm = require('unorm')
@@ -87,3 +104,25 @@ module.exports.unorm = require('unorm')
/* zxcvbn */
module.exports.zxcvbn = require('zxcvbn')
/* handshake */
module.exports.handshake = require('handshake-util')
/* bs58 */
try {
module.exports.bs58 = require('bs58')
}
catch (e) {
console.warn("Error loading bs58 library");
console.warn(e);
};
/* create-hash */
try {
module.exports.createHash = require('create-hash')
}
catch (e) {
console.warn("Error loading create-hash library");
console.warn(e);
};

View File

@@ -225,8 +225,7 @@
"base64-js": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz",
"integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==",
"dev": true
"integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g=="
},
"bchaddrjs": {
"version": "0.4.4",
@@ -237,10 +236,18 @@
"cashaddrjs": "^0.3.8"
}
},
"bchaddrjs-slp": {
"version": "git://github.com/simpleledger/bchaddrjs.git#af16e44a6bfbe4b3980a62dba50e2f68ed864c6b",
"from": "git://github.com/simpleledger/bchaddrjs.git#af16e44a6bfbe4b3980a62dba50e2f68ed864c6b",
"requires": {
"bs58check": "^2.1.2",
"cashaddrjs-slp": "^0.2.12"
}
},
"bech32": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.3.tgz",
"integrity": "sha512-yuVFUvrNcoJi0sv5phmqc6P+Fl1HjRDRNOOkHY2X/3LBy2bIGNSFx4fZ95HMaXHupuS7cZR15AsvtmCIF4UEyg=="
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz",
"integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ=="
},
"big-integer": {
"version": "1.6.36",
@@ -290,6 +297,18 @@
"create-hash": "^1.1.1",
"ecurve": "^1.0.0",
"scryptsy": "^2.0.0"
},
"dependencies": {
"bs58grscheck": {
"version": "git+https://github.com/Groestlcoin/bs58grscheck.git#020feec2b3153aeb278596ea70ce3579a37f4e21",
"from": "git+https://github.com/Groestlcoin/bs58grscheck.git",
"requires": {
"bs58": "^4.0.0",
"create-hash": "^1.1.0",
"groestl-hash-js": "git+https://github.com/Groestlcoin/groestl-hash-js.git",
"safe-buffer": "^5.1.2"
}
}
}
},
"bip39": {
@@ -318,9 +337,8 @@
"integrity": "sha512-pef6gxZFztEhaE9RY9HmWVmiIHqCb2OyS4HPKkpc6CIiiOa3Qmuoylxc5P2EkU3w+5eTSifI9SEZC88idAIGow=="
},
"bitcoinjs-lib": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/bitcoinjs-lib/-/bitcoinjs-lib-3.3.2.tgz",
"integrity": "sha512-l5qqvbaK8wwtANPf6oEffykycg4383XgEYdia1rI7/JpGf1jfRWlOUCvx5TiTZS7kyIvY4j/UhIQ2urLsvGkzw==",
"version": "git://github.com/iancoleman/bitcoinjs-lib.git#ac212f04e81313ddfda7ed28856ac6c7dfbe6f75",
"from": "git://github.com/iancoleman/bitcoinjs-lib.git#v3.3.2_16bit",
"requires": {
"bech32": "^1.1.2",
"bigi": "^1.4.0",
@@ -378,6 +396,23 @@
}
}
},
"blake2b": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/blake2b/-/blake2b-2.1.3.tgz",
"integrity": "sha512-pkDss4xFVbMb4270aCyGD3qLv92314Et+FsKzilCLxDz5DuZ2/1g3w4nmBbu6nKApPspnjG7JcwTjGZnduB1yg==",
"requires": {
"blake2b-wasm": "^1.1.0",
"nanoassert": "^1.0.0"
}
},
"blake2b-wasm": {
"version": "1.1.7",
"resolved": "https://registry.npmjs.org/blake2b-wasm/-/blake2b-wasm-1.1.7.tgz",
"integrity": "sha512-oFIHvXhlz/DUgF0kq5B1CqxIDjIJwh9iDeUUGQUcvgiGz7Wdw03McEO7CfLBy7QKGdsydcMCgO9jFNBAFCtFcA==",
"requires": {
"nanoassert": "^1.0.0"
}
},
"bn.js": {
"version": "4.11.8",
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz",
@@ -573,20 +608,26 @@
}
},
"bs58grscheck": {
"version": "git+https://github.com/Groestlcoin/bs58grscheck.git#020feec2b3153aeb278596ea70ce3579a37f4e21",
"from": "git+https://github.com/Groestlcoin/bs58grscheck.git",
"version": "2.1.2",
"resolved": "git+https://github.com/Groestlcoin/bs58grscheck.git#8ff31333a7626161c1484b461c20710bb9f97b93",
"requires": {
"bs58": "^4.0.0",
"create-hash": "^1.1.0",
"groestl-hash-js": "git+https://github.com/Groestlcoin/groestl-hash-js.git#ef6a04f1c4d2f0448f0882b5f213ef7a0659baee",
"groestl-hash-js": "^1.0.0",
"safe-buffer": "^5.1.2"
},
"dependencies": {
"groestl-hash-js": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/groestl-hash-js/-/groestl-hash-js-1.0.0.tgz",
"integrity": "sha1-yewyVxbsSLIjz6ruZzxfj/12Bsk="
}
}
},
"buffer": {
"version": "5.4.3",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.4.3.tgz",
"integrity": "sha512-zvj65TkFeIt3i6aj5bIvJDzjjQQGs4o/sNoezg1F1kYap9Nu2jcUdpwzRSJTHMMzG0H7bZkn4rNQpImhuxWX2A==",
"dev": true,
"requires": {
"base64-js": "^1.0.2",
"ieee754": "^1.1.4"
@@ -632,6 +673,14 @@
"big-integer": "1.6.36"
}
},
"cashaddrjs-slp": {
"version": "0.2.12",
"resolved": "https://registry.npmjs.org/cashaddrjs-slp/-/cashaddrjs-slp-0.2.12.tgz",
"integrity": "sha512-n2TTIuW6vZZxYvjvsUAA+wOM0Zkj+3RRKUtDC1XSu4Ic4XVr0yFJkl1bzQkHWda7nkVT51sxjZneygz7D0SyrQ==",
"requires": {
"big-integer": "^1.6.34"
}
},
"cipher-base": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz",
@@ -1114,18 +1163,27 @@
"bigi": "^1.4.0",
"bip66": "^1.1.0",
"bitcoin-ops": "^1.3.0",
"bs58grscheck": "git+https://github.com/Groestlcoin/bs58grscheck.git#020feec2b3153aeb278596ea70ce3579a37f4e21",
"bs58grscheck": "git+https://github.com/Groestlcoin/bs58grscheck.git",
"create-hash": "^1.1.0",
"create-hmac": "^1.1.3",
"ecurve": "^1.0.0",
"groestl-hash-js": "git+https://github.com/Groestlcoin/groestl-hash-js.git#ef6a04f1c4d2f0448f0882b5f213ef7a0659baee",
"groestl-hash-js": "git+https://github.com/Groestlcoin/groestl-hash-js.git",
"merkle-lib": "^2.0.10",
"pushdata-bitcoin": "^1.0.1",
"randombytes": "^2.0.1",
"safe-buffer": "^5.0.1",
"typeforce": "^1.11.3",
"varuint-bitcoin": "^1.0.4",
"wifgrs": "git+https://github.com/Groestlcoin/wifgrs.git#5e0ed45865ae5f9736dd8855f401da04423b0e86"
"wifgrs": "git+https://github.com/Groestlcoin/wifgrs.git"
}
},
"handshake-util": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/handshake-util/-/handshake-util-1.2.0.tgz",
"integrity": "sha512-LhjqYdYggZjFvaPoFl3MMZU3IdPS7OwF6AZdPg+B14aJHQ72FRXYalezjFE3tAV/wBTVdHfpis89MOGhbVWBbw==",
"requires": {
"bech32": "^1.1.3",
"blake2b": "^2.1.3"
}
},
"has": {
@@ -1198,8 +1256,7 @@
"ieee754": {
"version": "1.1.13",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz",
"integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==",
"dev": true
"integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg=="
},
"imurmurhash": {
"version": "0.1.4",
@@ -1322,9 +1379,9 @@
"dev": true
},
"jsrsasign": {
"version": "8.0.12",
"resolved": "https://registry.npmjs.org/jsrsasign/-/jsrsasign-8.0.12.tgz",
"integrity": "sha1-Iqu5ZW00owuVMENnIINeicLlwxY="
"version": "8.0.19",
"resolved": "https://registry.npmjs.org/jsrsasign/-/jsrsasign-8.0.19.tgz",
"integrity": "sha512-qf+F41huTh9ThXj5n3yfAJJRp8vx05JYbGlGvCjusYX50rsfqY6ASK08LCOutl0yA1BHIpGG8bd1w5x9aGy7Zg=="
},
"jssha": {
"version": "2.3.1",
@@ -1485,6 +1542,11 @@
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
"integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg=="
},
"nanoassert": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/nanoassert/-/nanoassert-1.1.0.tgz",
"integrity": "sha1-TzFS4JVA/eKMdvRLGbvNHVpCR40="
},
"nebulas": {
"version": "0.5.6",
"resolved": "https://registry.npmjs.org/nebulas/-/nebulas-0.5.6.tgz",
@@ -2204,10 +2266,10 @@
}
},
"wifgrs": {
"version": "git+https://github.com/Groestlcoin/wifgrs.git#5e0ed45865ae5f9736dd8855f401da04423b0e86",
"version": "git+https://github.com/Groestlcoin/wifgrs.git#970dafa1633f1b6e8bf51eb933c76a7203567ec2",
"from": "git+https://github.com/Groestlcoin/wifgrs.git",
"requires": {
"bs58grscheck": "git+https://github.com/Groestlcoin/bs58grscheck.git#020feec2b3153aeb278596ea70ce3579a37f4e21",
"bs58grscheck": "^2.1.2",
"safe-buffer": "^5.1.1"
}
},

View File

@@ -11,14 +11,19 @@
"bip38": "2.0.2",
"bip38grs": "git://github.com/Groestlcoin/bip38grs.git#091975b01679b74dc0a4136bb743fe17791b0151",
"bitcoinjs-lib": "git://github.com/iancoleman/bitcoinjs-lib.git#v3.3.2_16bit",
"buffer": "5.4.3",
"bs58": "^4.0.1",
"buffer": "^5.4.3",
"create-hash": "^1.2.0",
"ed25519-hd-key": "^1.0.0",
"elastos-wallet-js": "git://github.com/johnnynanjiang/Elastos.SDK.Keypair.Javascript.git#491dc51b64efaf0a8aae62028b68e2c8e38fde06",
"ethereumjs-util": "6.0.0",
"fast-levenshtein": "2.0.6",
"groestlcoinjs-lib": "git://github.com/Groestlcoin/groestlcoinjs-lib.git#3.3.2",
"handshake-util": "1.2.0",
"javascript-biginteger": "0.9.2",
"jsrsasign": "^8.0.19",
"kjua": "0.6.0",
"nanocurrency-web": "^1.2.2",
"nebulas": "0.5.6",
"stellar-base": "^0.10.0",
"unorm": "1.6.0",

View File

@@ -1,6 +1,6 @@
# Generate libs
```
npm install
npm install --no-optional
npm run build
```

View File

@@ -0,0 +1,15 @@
const NanoBase = require('nanocurrency-web');
window.nanoUtil = {
getKeypair: function (index, seed) {
const accounts = NanoBase.wallet.accounts(seed, index, index)
return {privKey: accounts[0].privateKey, pubKey: accounts[0].publicKey, address: accounts[0].address};
},
dummyNetwork: {
bip32: {public: 0, private: 0},
messagePrefix: '',
pubKeyHash: 0,
scriptHash: 0,
wif: 0,
},
}

1614
libs/nanocurrency-web/package-lock.json generated Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,14 @@
{
"name": "nano-util",
"version": "0.0.1",
"scripts": {
"build": "browserify nano-util.js > /tmp/nano-util.js"
},
"dependencies": {
"nanocurrency-web": "^1.2.2"
},
"devDependencies": {
"browserify": "^16.2.3",
"uglify-es": "^3.3.9"
}
}

View File

@@ -0,0 +1,4 @@
Build (will create a bundle and copy it to /tmp/nano-util.js):
npm install
npm run build

View File

@@ -15,9 +15,9 @@
}
},
"acorn": {
"version": "6.0.4",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.0.4.tgz",
"integrity": "sha512-VY4i5EKSKkofY2I+6QLTbTTN/UvEQPCo6eiwzzSaSWfpaDhOmStMCMod6wmuPciNq+XS0faCglFu2lHZpdHUtg==",
"version": "6.4.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz",
"integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==",
"dev": true
},
"acorn-dynamic-import": {
@@ -90,7 +90,7 @@
},
"util": {
"version": "0.10.3",
"resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz",
"resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz",
"integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=",
"dev": true,
"requires": {
@@ -186,7 +186,7 @@
"dependencies": {
"resolve": {
"version": "1.1.7",
"resolved": "http://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz",
"integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=",
"dev": true
}
@@ -581,9 +581,9 @@
}
},
"elliptic": {
"version": "6.4.1",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz",
"integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz",
"integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==",
"dev": true,
"requires": {
"bn.js": "^4.4.0",
@@ -810,9 +810,9 @@
}
},
"lodash": {
"version": "4.17.11",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz",
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg=="
"version": "4.17.19",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
"integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ=="
},
"lodash.memoize": {
"version": "3.0.4",
@@ -1085,7 +1085,7 @@
"dependencies": {
"string_decoder": {
"version": "1.1.1",
"resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"dev": true,
"requires": {

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -3,7 +3,7 @@
<head lang="en">
<meta charset="utf-8" />
<title>BIP39 - Mnemonic Code</title>
<link rel="stylesheet" href="css/bootstrap-3.3.7.css">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/app.css">
<meta content="Mnemonic code for generating deterministic keys" name="description"/>
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
@@ -15,7 +15,7 @@
<div class="container">
<h1 class="text-center">Mnemonic Code Converter</h1>
<p class="version">v0.4.2</p>
<p class="version">v0.5.0</p>
<hr>
<div class="row">
<div class="col-md-12">
@@ -24,7 +24,7 @@
<div class="form-group">
<div class="col-sm-2"></div>
<div class="col-sm-10">
<p>You can enter an existing BIP39 mnemonic, or generate a new random one. Typing your own twelve words will probably not work how you expect, since the words require a particular structure (the last word is a checksum).</p>
<p>You can enter an existing BIP39 mnemonic, or generate a new random one. Typing your own twelve words will probably not work how you expect, since the words require a particular structure (the last word contains a checksum).</p>
<p>
For more info see the
<a href="https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki" target="_blank">BIP39 spec</a>.
@@ -86,7 +86,7 @@
<div class="row">
<label class="col-sm-3 control-label">Entropy Type</label>
<div class="type col-sm-3 form-control-static"></div>
<label class="col-sm-3 control-label">Bits Per Event</label>
<label class="col-sm-3 control-label">Avg Bits Per Event</label>
<div class="bits-per-event col-sm-3 form-control-static"></div>
</div>
<div class="row">
@@ -204,12 +204,22 @@
</div>
</div>
<div class="form-group">
<label for="phrase" class="col-sm-2 control-label">BIP39 Split Mnemonic</label>
<div class="splitMnemonic hidden">
<label for="phrase" class="col-sm-2 control-label">BIP39 Split Mnemonic</label>
<div class="col-sm-10">
<textarea id="phraseSplit" class="phraseSplit private-data form-control" title="Only 2 of 3 cards needed to recover." rows="3"></textarea>
<p class="help-block">
<span id="phraseSplitWarn" class="phraseSplitWarn"></span>
</p>
</div>
</div>
<div class="col-sm-2">
</div>
<div class="col-sm-10">
<textarea id="phraseSplit" class="phraseSplit private-data form-control" title="Only 2 of 3 cards needed to recover." rows="3"></textarea>
<p class="help-block">
<span id="phraseSplitWarn" class="phraseSplitWarn"></span>
</p>
<label class="control-label text-weight-normal">
<input type="checkbox" class="showSplitMnemonic">
Show split mnemonic cards
</label>
</div>
</div>
<div class="form-group">
@@ -828,6 +838,19 @@
<p>
<a href="https://bitcointalk.org/index.php?topic=311000.msg3345309#msg3345309" target="_blank">You are not a good source of entropy.</a>
</p>
<p>
<span>Card entropy has been implemented assuming cards are replaced, not drawn one after another.</span>
<span>A full deck with replacement generates 232 bits of entropy (21 words). A full deck without replacement generates 225 bits of entropy (21 words).</span>
<span>Card entropy changed significantly from v0.4.3 to v0.5.0. The old version can be accessed at
<a href="https://github.com/iancoleman/bip39/releases/tag/0.4.3">
https://github.com/iancoleman/bip39/releases/tag/0.4.3
</a>
or
<a href="https://web.archive.org/web/20201018232020/https://iancoleman.io/bip39/">
https://web.archive.org/web/20201018232020/https://iancoleman.io/bip39/
</a>
</span>
</p>
<h3>License</h3>
<p>
<span>Please refer to <a href="https://github.com/iancoleman/bip39/blob/master/LICENSE" target="_blank">the software license</a> for more detail.
@@ -871,9 +894,9 @@
on any offline computer.
</p>
<p>
<span>Alternatively, download the file from the repository</span>
<span>Alternatively, download the file from the latest GitHub release</span>
-
<a href="https://github.com/iancoleman/bip39">https://github.com/iancoleman/bip39</a>
<a href="https://github.com/iancoleman/bip39/releases/latest/">https://github.com/iancoleman/bip39/releases/latest/</a>
</p>
</div>
@@ -958,13 +981,15 @@
</tr>
</script>
<script src="js/jquery-3.2.1.js"></script>
<script src="js/bootstrap-3.3.7.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/bip39-libs.js"></script>
<script src="js/bitcoinjs-extensions.js"></script>
<script src="js/segwit-parameters.js"></script>
<script src="js/ripple-util.js"></script>
<script src="js/jingtum-util.js"></script>
<script src="js/casinocoin-util.js"></script>
<script src="js/eos-util.js"></script>
<script src="js/fio-util.js"></script>
<script src="js/sjcl-bip39.js"></script>
<script src="js/wordlist_english.js"></script>
<script src="js/wordlist_japanese.js"></script>

2
src/js/bip39-libs.js Normal file → Executable file

File diff suppressed because one or more lines are too long

View File

@@ -139,6 +139,17 @@ libs.bitcoin.networks.axe = {
wif: 0xcc
};
libs.bitcoin.networks.scribe = {
messagePrefix: 'unused',
bip32: {
public: 0x0488B21E,
private: 0x0488ADE4
},
pubKeyHash: 0x3c,
scriptHash: 0x7d,
wif: 0x6e
};
libs.bitcoin.networks.slimcoin = {
messagePrefix: 'unused',
bip32: {
@@ -581,6 +592,17 @@ libs.bitcoin.networks.cannacoin = {
wif: 0x9c,
};
libs.bitcoin.networks.cranepay = {
messagePrefix: '\x18Bitcoin Signed Message:\n',
bip32: {
public: 0x0488b21e,
private: 0x0488ade4
},
pubKeyHash: 28,
scriptHash: 10,
wif: 123,
};
libs.bitcoin.networks.cryptoescudo = {
messagePrefix: '\x18Cryptoescudo Signed Message:\n',
bip32: {
@@ -1175,6 +1197,31 @@ libs.bitcoin.networks.revolutionvr = {
wif: 0xc6,
};
libs.bitcoin.networks.rsk = {
messagePrefix: '\x18RSK Signed Message:\n',
bip32: {
public: 0x0488b21e,
private: 0x0488ade4
},
// TODO defaulting to Bitcoin value, check this
pubKeyHash: 0x00,
// TODO defaulting to Bitcoin value, check this
scriptHash: 0x05,
// TODO defaulting to Bitcoin value, check this
wif: 0x80
};
libs.bitcoin.networks.rsktestnet = {
messagePrefix: '\x18RSK Testnet Signed Message:\n',
bip32: {
public: 0x043587cf,
private: 0x04358394
},
pubKeyHash: 0x6f,
scriptHash: 0xc4,
wif: 0xef
};
libs.bitcoin.networks.rubycoin = {
messagePrefix: '\x18Rubycoin Signed Message:\n',
bip32: {
@@ -1739,6 +1786,28 @@ libs.bitcoin.networks.elastos = {
wif: 0xef // TODO set this correctly, same as BTC for now
};
libs.bitcoin.networks.sugarchain = {
messagePrefix: '\x18Sugarchain Signed Message:\n',
bip32: {
public: 0x0488B21E,
private: 0x0488ADE4,
},
pubKeyHash: 0x3f,
scriptHash: 0x7d,
wif: 0x80
};
libs.bitcoin.networks.sugarchaintestnet = {
messagePrefix: '\x18Sugarchain Signed Message:\n',
bip32: {
public: 0x045f1cf6,
private: 0x045f18bc,
},
pubKeyHash: 0x42,
scriptHash: 0x80,
wif: 0xef
};
// https://github.com/libs.bitcoinjs-lib/blob/3f6f5ef97a1ee1b8337865209282c0095e22b2e7/src/networks.js
libs.bitcoin.networks.regtest = {
messagePrefix: '\x18Bitcoin Signed Message:\n',
@@ -1751,3 +1820,14 @@ libs.bitcoin.networks.regtest = {
scriptHash: 0xc4,
wif: 0xef,
};
libs.bitcoin.networks.argoneum = {
messagePrefix: 'unused',
bip32: {
public: 0x0488b21e,
private: 0x0488ade4
},
pubKeyHash: 0x32,
scriptHash: 0x61,
wif: 0xbf
};

View File

@@ -1,6 +1,6 @@
/*!
* Bootstrap v3.3.7 (http://getbootstrap.com)
* Copyright 2011-2016 Twitter, Inc.
* Bootstrap v3.4.1 (https://getbootstrap.com/)
* Copyright 2011-2019 Twitter, Inc.
* Licensed under the MIT license
*/
@@ -17,10 +17,10 @@ if (typeof jQuery === 'undefined') {
}(jQuery);
/* ========================================================================
* Bootstrap: transition.js v3.3.7
* http://getbootstrap.com/javascript/#transitions
* Bootstrap: transition.js v3.4.1
* https://getbootstrap.com/docs/3.4/javascript/#transitions
* ========================================================================
* Copyright 2011-2016 Twitter, Inc.
* Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -28,7 +28,7 @@ if (typeof jQuery === 'undefined') {
+function ($) {
'use strict';
// CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
// CSS TRANSITION SUPPORT (Shoutout: https://modernizr.com/)
// ============================================================
function transitionEnd() {
@@ -50,7 +50,7 @@ if (typeof jQuery === 'undefined') {
return false // explicit for ie8 ( ._.)
}
// http://blog.alexmaccaw.com/css-transitions
// https://blog.alexmaccaw.com/css-transitions
$.fn.emulateTransitionEnd = function (duration) {
var called = false
var $el = this
@@ -77,10 +77,10 @@ if (typeof jQuery === 'undefined') {
}(jQuery);
/* ========================================================================
* Bootstrap: alert.js v3.3.7
* http://getbootstrap.com/javascript/#alerts
* Bootstrap: alert.js v3.4.1
* https://getbootstrap.com/docs/3.4/javascript/#alerts
* ========================================================================
* Copyright 2011-2016 Twitter, Inc.
* Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -96,7 +96,7 @@ if (typeof jQuery === 'undefined') {
$(el).on('click', dismiss, this.close)
}
Alert.VERSION = '3.3.7'
Alert.VERSION = '3.4.1'
Alert.TRANSITION_DURATION = 150
@@ -109,7 +109,8 @@ if (typeof jQuery === 'undefined') {
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}
var $parent = $(selector === '#' ? [] : selector)
selector = selector === '#' ? [] : selector
var $parent = $(document).find(selector)
if (e) e.preventDefault()
@@ -172,10 +173,10 @@ if (typeof jQuery === 'undefined') {
}(jQuery);
/* ========================================================================
* Bootstrap: button.js v3.3.7
* http://getbootstrap.com/javascript/#buttons
* Bootstrap: button.js v3.4.1
* https://getbootstrap.com/docs/3.4/javascript/#buttons
* ========================================================================
* Copyright 2011-2016 Twitter, Inc.
* Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -192,7 +193,7 @@ if (typeof jQuery === 'undefined') {
this.isLoading = false
}
Button.VERSION = '3.3.7'
Button.VERSION = '3.4.1'
Button.DEFAULTS = {
loadingText: 'loading...'
@@ -298,10 +299,10 @@ if (typeof jQuery === 'undefined') {
}(jQuery);
/* ========================================================================
* Bootstrap: carousel.js v3.3.7
* http://getbootstrap.com/javascript/#carousel
* Bootstrap: carousel.js v3.4.1
* https://getbootstrap.com/docs/3.4/javascript/#carousel
* ========================================================================
* Copyright 2011-2016 Twitter, Inc.
* Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -329,7 +330,7 @@ if (typeof jQuery === 'undefined') {
.on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
}
Carousel.VERSION = '3.3.7'
Carousel.VERSION = '3.4.1'
Carousel.TRANSITION_DURATION = 600
@@ -443,7 +444,9 @@ if (typeof jQuery === 'undefined') {
var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
if ($.support.transition && this.$element.hasClass('slide')) {
$next.addClass(type)
$next[0].offsetWidth // force reflow
if (typeof $next === 'object' && $next.length) {
$next[0].offsetWidth // force reflow
}
$active.addClass(direction)
$next.addClass(direction)
$active
@@ -505,10 +508,17 @@ if (typeof jQuery === 'undefined') {
// =================
var clickHandler = function (e) {
var href
var $this = $(this)
var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
var href = $this.attr('href')
if (href) {
href = href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
}
var target = $this.attr('data-target') || href
var $target = $(document).find(target)
if (!$target.hasClass('carousel')) return
var options = $.extend({}, $target.data(), $this.data())
var slideIndex = $this.attr('data-slide-to')
if (slideIndex) options.interval = false
@@ -536,10 +546,10 @@ if (typeof jQuery === 'undefined') {
}(jQuery);
/* ========================================================================
* Bootstrap: collapse.js v3.3.7
* http://getbootstrap.com/javascript/#collapse
* Bootstrap: collapse.js v3.4.1
* https://getbootstrap.com/docs/3.4/javascript/#collapse
* ========================================================================
* Copyright 2011-2016 Twitter, Inc.
* Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -567,7 +577,7 @@ if (typeof jQuery === 'undefined') {
if (this.options.toggle) this.toggle()
}
Collapse.VERSION = '3.3.7'
Collapse.VERSION = '3.4.1'
Collapse.TRANSITION_DURATION = 350
@@ -674,7 +684,7 @@ if (typeof jQuery === 'undefined') {
}
Collapse.prototype.getParent = function () {
return $(this.options.parent)
return $(document).find(this.options.parent)
.find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
.each($.proxy(function (i, element) {
var $element = $(element)
@@ -697,7 +707,7 @@ if (typeof jQuery === 'undefined') {
var target = $trigger.attr('data-target')
|| (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
return $(target)
return $(document).find(target)
}
@@ -749,10 +759,10 @@ if (typeof jQuery === 'undefined') {
}(jQuery);
/* ========================================================================
* Bootstrap: dropdown.js v3.3.7
* http://getbootstrap.com/javascript/#dropdowns
* Bootstrap: dropdown.js v3.4.1
* https://getbootstrap.com/docs/3.4/javascript/#dropdowns
* ========================================================================
* Copyright 2011-2016 Twitter, Inc.
* Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -769,7 +779,7 @@ if (typeof jQuery === 'undefined') {
$(element).on('click.bs.dropdown', this.toggle)
}
Dropdown.VERSION = '3.3.7'
Dropdown.VERSION = '3.4.1'
function getParent($this) {
var selector = $this.attr('data-target')
@@ -779,7 +789,7 @@ if (typeof jQuery === 'undefined') {
selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}
var $parent = selector && $(selector)
var $parent = selector !== '#' ? $(document).find(selector) : null
return $parent && $parent.length ? $parent : $this.parent()
}
@@ -915,10 +925,10 @@ if (typeof jQuery === 'undefined') {
}(jQuery);
/* ========================================================================
* Bootstrap: modal.js v3.3.7
* http://getbootstrap.com/javascript/#modals
* Bootstrap: modal.js v3.4.1
* https://getbootstrap.com/docs/3.4/javascript/#modals
* ========================================================================
* Copyright 2011-2016 Twitter, Inc.
* Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -930,15 +940,16 @@ if (typeof jQuery === 'undefined') {
// ======================
var Modal = function (element, options) {
this.options = options
this.$body = $(document.body)
this.$element = $(element)
this.$dialog = this.$element.find('.modal-dialog')
this.$backdrop = null
this.isShown = null
this.originalBodyPad = null
this.scrollbarWidth = 0
this.options = options
this.$body = $(document.body)
this.$element = $(element)
this.$dialog = this.$element.find('.modal-dialog')
this.$backdrop = null
this.isShown = null
this.originalBodyPad = null
this.scrollbarWidth = 0
this.ignoreBackdropClick = false
this.fixedContent = '.navbar-fixed-top, .navbar-fixed-bottom'
if (this.options.remote) {
this.$element
@@ -949,7 +960,7 @@ if (typeof jQuery === 'undefined') {
}
}
Modal.VERSION = '3.3.7'
Modal.VERSION = '3.4.1'
Modal.TRANSITION_DURATION = 300
Modal.BACKDROP_TRANSITION_DURATION = 150
@@ -966,7 +977,7 @@ if (typeof jQuery === 'undefined') {
Modal.prototype.show = function (_relatedTarget) {
var that = this
var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
this.$element.trigger(e)
@@ -1057,8 +1068,8 @@ if (typeof jQuery === 'undefined') {
.off('focusin.bs.modal') // guard against infinite focus loop
.on('focusin.bs.modal', $.proxy(function (e) {
if (document !== e.target &&
this.$element[0] !== e.target &&
!this.$element.has(e.target).length) {
this.$element[0] !== e.target &&
!this.$element.has(e.target).length) {
this.$element.trigger('focus')
}
}, this))
@@ -1160,7 +1171,7 @@ if (typeof jQuery === 'undefined') {
var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight
this.$element.css({
paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
})
}
@@ -1185,11 +1196,26 @@ if (typeof jQuery === 'undefined') {
Modal.prototype.setScrollbar = function () {
var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
this.originalBodyPad = document.body.style.paddingRight || ''
if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
var scrollbarWidth = this.scrollbarWidth
if (this.bodyIsOverflowing) {
this.$body.css('padding-right', bodyPad + scrollbarWidth)
$(this.fixedContent).each(function (index, element) {
var actualPadding = element.style.paddingRight
var calculatedPadding = $(element).css('padding-right')
$(element)
.data('padding-right', actualPadding)
.css('padding-right', parseFloat(calculatedPadding) + scrollbarWidth + 'px')
})
}
}
Modal.prototype.resetScrollbar = function () {
this.$body.css('padding-right', this.originalBodyPad)
$(this.fixedContent).each(function (index, element) {
var padding = $(element).data('padding-right')
$(element).removeData('padding-right')
element.style.paddingRight = padding ? padding : ''
})
}
Modal.prototype.measureScrollbar = function () { // thx walsh
@@ -1207,8 +1233,8 @@ if (typeof jQuery === 'undefined') {
function Plugin(option, _relatedTarget) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.modal')
var $this = $(this)
var data = $this.data('bs.modal')
var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
@@ -1219,7 +1245,7 @@ if (typeof jQuery === 'undefined') {
var old = $.fn.modal
$.fn.modal = Plugin
$.fn.modal = Plugin
$.fn.modal.Constructor = Modal
@@ -1236,10 +1262,13 @@ if (typeof jQuery === 'undefined') {
// ==============
$(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
var $this = $(this)
var href = $this.attr('href')
var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
var $this = $(this)
var href = $this.attr('href')
var target = $this.attr('data-target') ||
(href && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
var $target = $(document).find(target)
var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
if ($this.is('a')) e.preventDefault()
@@ -1255,18 +1284,148 @@ if (typeof jQuery === 'undefined') {
}(jQuery);
/* ========================================================================
* Bootstrap: tooltip.js v3.3.7
* http://getbootstrap.com/javascript/#tooltip
* Bootstrap: tooltip.js v3.4.1
* https://getbootstrap.com/docs/3.4/javascript/#tooltip
* Inspired by the original jQuery.tipsy by Jason Frame
* ========================================================================
* Copyright 2011-2016 Twitter, Inc.
* Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']
var uriAttrs = [
'background',
'cite',
'href',
'itemtype',
'longdesc',
'poster',
'src',
'xlink:href'
]
var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i
var DefaultWhitelist = {
// Global attributes allowed on any supplied element below.
'*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
a: ['target', 'href', 'title', 'rel'],
area: [],
b: [],
br: [],
col: [],
code: [],
div: [],
em: [],
hr: [],
h1: [],
h2: [],
h3: [],
h4: [],
h5: [],
h6: [],
i: [],
img: ['src', 'alt', 'title', 'width', 'height'],
li: [],
ol: [],
p: [],
pre: [],
s: [],
small: [],
span: [],
sub: [],
sup: [],
strong: [],
u: [],
ul: []
}
/**
* A pattern that recognizes a commonly useful subset of URLs that are safe.
*
* Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
*/
var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi
/**
* A pattern that matches safe data URLs. Only matches image, video and audio types.
*
* Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
*/
var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i
function allowedAttribute(attr, allowedAttributeList) {
var attrName = attr.nodeName.toLowerCase()
if ($.inArray(attrName, allowedAttributeList) !== -1) {
if ($.inArray(attrName, uriAttrs) !== -1) {
return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN))
}
return true
}
var regExp = $(allowedAttributeList).filter(function (index, value) {
return value instanceof RegExp
})
// Check if a regular expression validates the attribute.
for (var i = 0, l = regExp.length; i < l; i++) {
if (attrName.match(regExp[i])) {
return true
}
}
return false
}
function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
if (unsafeHtml.length === 0) {
return unsafeHtml
}
if (sanitizeFn && typeof sanitizeFn === 'function') {
return sanitizeFn(unsafeHtml)
}
// IE 8 and below don't support createHTMLDocument
if (!document.implementation || !document.implementation.createHTMLDocument) {
return unsafeHtml
}
var createdDocument = document.implementation.createHTMLDocument('sanitization')
createdDocument.body.innerHTML = unsafeHtml
var whitelistKeys = $.map(whiteList, function (el, i) { return i })
var elements = $(createdDocument.body).find('*')
for (var i = 0, len = elements.length; i < len; i++) {
var el = elements[i]
var elName = el.nodeName.toLowerCase()
if ($.inArray(elName, whitelistKeys) === -1) {
el.parentNode.removeChild(el)
continue
}
var attributeList = $.map(el.attributes, function (el) { return el })
var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || [])
for (var j = 0, len2 = attributeList.length; j < len2; j++) {
if (!allowedAttribute(attributeList[j], whitelistedAttributes)) {
el.removeAttribute(attributeList[j].nodeName)
}
}
}
return createdDocument.body.innerHTML
}
// TOOLTIP PUBLIC CLASS DEFINITION
// ===============================
@@ -1282,7 +1441,7 @@ if (typeof jQuery === 'undefined') {
this.init('tooltip', element, options)
}
Tooltip.VERSION = '3.3.7'
Tooltip.VERSION = '3.4.1'
Tooltip.TRANSITION_DURATION = 150
@@ -1299,7 +1458,10 @@ if (typeof jQuery === 'undefined') {
viewport: {
selector: 'body',
padding: 0
}
},
sanitize : true,
sanitizeFn : null,
whiteList : DefaultWhitelist
}
Tooltip.prototype.init = function (type, element, options) {
@@ -1307,7 +1469,7 @@ if (typeof jQuery === 'undefined') {
this.type = type
this.$element = $(element)
this.options = this.getOptions(options)
this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
this.$viewport = this.options.viewport && $(document).find($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
this.inState = { click: false, hover: false, focus: false }
if (this.$element[0] instanceof document.constructor && !this.options.selector) {
@@ -1340,7 +1502,15 @@ if (typeof jQuery === 'undefined') {
}
Tooltip.prototype.getOptions = function (options) {
options = $.extend({}, this.getDefaults(), this.$element.data(), options)
var dataAttributes = this.$element.data()
for (var dataAttr in dataAttributes) {
if (dataAttributes.hasOwnProperty(dataAttr) && $.inArray(dataAttr, DISALLOWED_ATTRIBUTES) !== -1) {
delete dataAttributes[dataAttr]
}
}
options = $.extend({}, this.getDefaults(), dataAttributes, options)
if (options.delay && typeof options.delay == 'number') {
options.delay = {
@@ -1349,6 +1519,10 @@ if (typeof jQuery === 'undefined') {
}
}
if (options.sanitize) {
options.template = sanitizeHtml(options.template, options.whiteList, options.sanitizeFn)
}
return options
}
@@ -1460,7 +1634,7 @@ if (typeof jQuery === 'undefined') {
.addClass(placement)
.data('bs.' + this.type, this)
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
this.options.container ? $tip.appendTo($(document).find(this.options.container)) : $tip.insertAfter(this.$element)
this.$element.trigger('inserted.bs.' + this.type)
var pos = this.getPosition()
@@ -1562,7 +1736,16 @@ if (typeof jQuery === 'undefined') {
var $tip = this.tip()
var title = this.getTitle()
$tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
if (this.options.html) {
if (this.options.sanitize) {
title = sanitizeHtml(title, this.options.whiteList, this.options.sanitizeFn)
}
$tip.find('.tooltip-inner').html(title)
} else {
$tip.find('.tooltip-inner').text(title)
}
$tip.removeClass('fade in top bottom left right')
}
@@ -1743,6 +1926,9 @@ if (typeof jQuery === 'undefined') {
})
}
Tooltip.prototype.sanitizeHtml = function (unsafeHtml) {
return sanitizeHtml(unsafeHtml, this.options.whiteList, this.options.sanitizeFn)
}
// TOOLTIP PLUGIN DEFINITION
// =========================
@@ -1776,10 +1962,10 @@ if (typeof jQuery === 'undefined') {
}(jQuery);
/* ========================================================================
* Bootstrap: popover.js v3.3.7
* http://getbootstrap.com/javascript/#popovers
* Bootstrap: popover.js v3.4.1
* https://getbootstrap.com/docs/3.4/javascript/#popovers
* ========================================================================
* Copyright 2011-2016 Twitter, Inc.
* Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -1796,7 +1982,7 @@ if (typeof jQuery === 'undefined') {
if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
Popover.VERSION = '3.3.7'
Popover.VERSION = '3.4.1'
Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
placement: 'right',
@@ -1822,10 +2008,25 @@ if (typeof jQuery === 'undefined') {
var title = this.getTitle()
var content = this.getContent()
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
$tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events
this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
](content)
if (this.options.html) {
var typeContent = typeof content
if (this.options.sanitize) {
title = this.sanitizeHtml(title)
if (typeContent === 'string') {
content = this.sanitizeHtml(content)
}
}
$tip.find('.popover-title').html(title)
$tip.find('.popover-content').children().detach().end()[
typeContent === 'string' ? 'html' : 'append'
](content)
} else {
$tip.find('.popover-title').text(title)
$tip.find('.popover-content').children().detach().end().text(content)
}
$tip.removeClass('fade top bottom left right in')
@@ -1844,8 +2045,8 @@ if (typeof jQuery === 'undefined') {
return $e.attr('data-content')
|| (typeof o.content == 'function' ?
o.content.call($e[0]) :
o.content)
o.content.call($e[0]) :
o.content)
}
Popover.prototype.arrow = function () {
@@ -1885,10 +2086,10 @@ if (typeof jQuery === 'undefined') {
}(jQuery);
/* ========================================================================
* Bootstrap: scrollspy.js v3.3.7
* http://getbootstrap.com/javascript/#scrollspy
* Bootstrap: scrollspy.js v3.4.1
* https://getbootstrap.com/docs/3.4/javascript/#scrollspy
* ========================================================================
* Copyright 2011-2016 Twitter, Inc.
* Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -1914,7 +2115,7 @@ if (typeof jQuery === 'undefined') {
this.process()
}
ScrollSpy.VERSION = '3.3.7'
ScrollSpy.VERSION = '3.4.1'
ScrollSpy.DEFAULTS = {
offset: 10
@@ -2058,10 +2259,10 @@ if (typeof jQuery === 'undefined') {
}(jQuery);
/* ========================================================================
* Bootstrap: tab.js v3.3.7
* http://getbootstrap.com/javascript/#tabs
* Bootstrap: tab.js v3.4.1
* https://getbootstrap.com/docs/3.4/javascript/#tabs
* ========================================================================
* Copyright 2011-2016 Twitter, Inc.
* Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -2078,7 +2279,7 @@ if (typeof jQuery === 'undefined') {
// jscs:enable requireDollarBeforejQueryAssignment
}
Tab.VERSION = '3.3.7'
Tab.VERSION = '3.4.1'
Tab.TRANSITION_DURATION = 150
@@ -2107,7 +2308,7 @@ if (typeof jQuery === 'undefined') {
if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
var $target = $(selector)
var $target = $(document).find(selector)
this.activate($this.closest('li'), $ul)
this.activate($target, $target.parent(), function () {
@@ -2132,15 +2333,15 @@ if (typeof jQuery === 'undefined') {
$active
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
.removeClass('active')
.end()
.find('[data-toggle="tab"]')
.attr('aria-expanded', false)
.attr('aria-expanded', false)
element
.addClass('active')
.find('[data-toggle="tab"]')
.attr('aria-expanded', true)
.attr('aria-expanded', true)
if (transition) {
element[0].offsetWidth // reflow for transition
@@ -2152,10 +2353,10 @@ if (typeof jQuery === 'undefined') {
if (element.parent('.dropdown-menu').length) {
element
.closest('li.dropdown')
.addClass('active')
.addClass('active')
.end()
.find('[data-toggle="tab"]')
.attr('aria-expanded', true)
.attr('aria-expanded', true)
}
callback && callback()
@@ -2214,10 +2415,10 @@ if (typeof jQuery === 'undefined') {
}(jQuery);
/* ========================================================================
* Bootstrap: affix.js v3.3.7
* http://getbootstrap.com/javascript/#affix
* Bootstrap: affix.js v3.4.1
* https://getbootstrap.com/docs/3.4/javascript/#affix
* ========================================================================
* Copyright 2011-2016 Twitter, Inc.
* Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -2231,7 +2432,9 @@ if (typeof jQuery === 'undefined') {
var Affix = function (element, options) {
this.options = $.extend({}, Affix.DEFAULTS, options)
this.$target = $(this.options.target)
var target = this.options.target === Affix.DEFAULTS.target ? $(this.options.target) : $(document).find(this.options.target)
this.$target = target
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
@@ -2243,7 +2446,7 @@ if (typeof jQuery === 'undefined') {
this.checkPosition()
}
Affix.VERSION = '3.3.7'
Affix.VERSION = '3.4.1'
Affix.RESET = 'affix affix-top affix-bottom'

View File

@@ -16,7 +16,136 @@
window.Entropy = new (function() {
var TWO = new libs.BigInteger.BigInteger(2);
let eventBits = {
"binary": {
"0": "0",
"1": "1",
},
// log2(6) = 2.58496 bits per roll, with bias
// 4 rolls give 2 bits each
// 2 rolls give 1 bit each
// Average (4*2 + 2*1) / 6 = 1.66 bits per roll without bias
"base 6": {
"0": "00",
"1": "01",
"2": "10",
"3": "11",
"4": "0",
"5": "1",
},
// log2(6) = 2.58496 bits per roll, with bias
// 4 rolls give 2 bits each
// 2 rolls give 1 bit each
// Average (4*2 + 2*1) / 6 = 1.66 bits per roll without bias
"base 6 (dice)": {
"0": "00", // equivalent to 0 in base 6
"1": "01",
"2": "10",
"3": "11",
"4": "0",
"5": "1",
},
// log2(10) = 3.321928 bits per digit, with bias
// 8 digits give 3 bits each
// 2 digits give 1 bit each
// Average (8*3 + 2*1) / 10 = 2.6 bits per digit without bias
"base 10": {
"0": "000",
"1": "001",
"2": "010",
"3": "011",
"4": "100",
"5": "101",
"6": "110",
"7": "111",
"8": "0",
"9": "1",
},
"hexadecimal": {
"0": "0000",
"1": "0001",
"2": "0010",
"3": "0011",
"4": "0100",
"5": "0101",
"6": "0110",
"7": "0111",
"8": "1000",
"9": "1001",
"a": "1010",
"b": "1011",
"c": "1100",
"d": "1101",
"e": "1110",
"f": "1111",
},
// log2(52) = 5.7004 bits per card, with bias
// 32 cards give 5 bits each
// 16 cards give 4 bits each
// 4 cards give 2 bits each
// Average (32*5 + 16*4 + 4*2) / 52 = 4.46 bits per card without bias
"card": {
"ac": "00000",
"2c": "00001",
"3c": "00010",
"4c": "00011",
"5c": "00100",
"6c": "00101",
"7c": "00110",
"8c": "00111",
"9c": "01000",
"tc": "01001",
"jc": "01010",
"qc": "01011",
"kc": "01100",
"ad": "01101",
"2d": "01110",
"3d": "01111",
"4d": "10000",
"5d": "10001",
"6d": "10010",
"7d": "10011",
"8d": "10100",
"9d": "10101",
"td": "10110",
"jd": "10111",
"qd": "11000",
"kd": "11001",
"ah": "11010",
"2h": "11011",
"3h": "11100",
"4h": "11101",
"5h": "11110",
"6h": "11111",
"7h": "0000",
"8h": "0001",
"9h": "0010",
"th": "0011",
"jh": "0100",
"qh": "0101",
"kh": "0110",
"as": "0111",
"2s": "1000",
"3s": "1001",
"4s": "1010",
"5s": "1011",
"6s": "1100",
"7s": "1101",
"8s": "1110",
"9s": "1111",
"ts": "00",
"js": "01",
"qs": "10",
"ks": "11",
},
}
// matchers returns an array of the matched events for each type of entropy.
// eg
@@ -51,48 +180,28 @@ window.Entropy = new (function() {
}
}
// Convert array of cards from ["ac", "4d", "ks"]
// to numbers between 0 and 51 [0, 16, 51]
function convertCardsToInts(cards) {
var ints = [];
var values = "a23456789tjqk";
var suits = "cdhs";
for (var i=0; i<cards.length; i++) {
var card = cards[i].toLowerCase();
var value = card[0];
var suit = card[1];
var asInt = 13 * suits.indexOf(suit) + values.indexOf(value);
ints.push(asInt);
}
return ints;
}
this.fromString = function(rawEntropyStr, baseStr) {
// Find type of entropy being used (binary, hex, dice etc)
var base = getBase(rawEntropyStr, baseStr);
// Convert dice to base6 entropy (ie 1-6 to 0-5)
// This is done by changing all 6s to 0s
if (base.str == "dice") {
var newParts = [];
var newInts = [];
for (var i=0; i<base.parts.length; i++) {
var c = base.parts[i];
var newEvents = [];
for (var i=0; i<base.events.length; i++) {
var c = base.events[i];
if ("12345".indexOf(c) > -1) {
newParts[i] = base.parts[i];
newInts[i] = base.ints[i];
newEvents[i] = base.events[i];
}
else {
newParts[i] = "0";
newInts[i] = 0;
newEvents[i] = "0";
}
}
base.str = "base 6 (dice)";
base.ints = newInts;
base.parts = newParts;
base.events = newEvents;
base.matcher = matchers.base6;
}
// Detect empty entropy
if (base.parts.length == 0) {
if (base.events.length == 0) {
return {
binaryStr: "",
cleanStr: "",
@@ -100,44 +209,23 @@ window.Entropy = new (function() {
base: base,
};
}
// Convert base.ints to BigInteger.
// Due to using unusual bases, eg cards of base52, this is not as simple as
// using BigInteger.parse()
var entropyInt = libs.BigInteger.BigInteger.ZERO;
for (var i=base.ints.length-1; i>=0; i--) {
var thisInt = libs.BigInteger.BigInteger.parse(base.ints[i]);
var power = (base.ints.length - 1) - i;
var additionalEntropy = libs.BigInteger.BigInteger.parse(base.asInt).pow(power).multiply(thisInt);
entropyInt = entropyInt.add(additionalEntropy);
}
// Convert entropy to binary
var entropyBin = entropyInt.toString(2);
// If the first integer is small, it must be padded with zeros.
// Otherwise the chance of the first bit being 1 is 100%, which is
// obviously incorrect.
// This is not perfect for non-2^n bases.
var expectedBits = Math.floor(base.parts.length * Math.log2(base.asInt));
while (entropyBin.length < expectedBits) {
entropyBin = "0" + entropyBin;
}
// Calculate the number of bits per event
var bitsPerEvent = Math.log2(base.asInt);
// Cards binary must be handled differently, since they're not replaced
if (base.asInt == 52) {
var cardEntropy = processCardEntropy(base.parts);
entropyBin = cardEntropy.binaryStr;
bitsPerEvent = cardEntropy.bitsPerEvent;
}
// Convert entropy events to binary
var entropyBin = base.events.map(function(e) {
return eventBits[base.str][e.toLowerCase()];
}).join("");
// Get average bits per event
// which may be adjusted for bias if log2(base) is fractional
var bitsPerEvent = base.bitsPerEvent;
// Supply a 'filtered' entropy string for display purposes
var entropyClean = base.parts.join("");
var entropyHtml = base.parts.join("");
var entropyClean = base.events.join("");
var entropyHtml = base.events.join("");
if (base.asInt == 52) {
entropyClean = base.parts.join(" ").toUpperCase();
entropyClean = base.events.join(" ").toUpperCase();
entropyClean = entropyClean.replace(/C/g, "\u2663");
entropyClean = entropyClean.replace(/D/g, "\u2666");
entropyClean = entropyClean.replace(/H/g, "\u2665");
entropyClean = entropyClean.replace(/S/g, "\u2660");
entropyHtml = base.parts.join(" ").toUpperCase();
entropyHtml = base.events.join(" ").toUpperCase();
entropyHtml = entropyHtml.replace(/C/g, "<span class='card-suit club'>\u2663</span>");
entropyHtml = entropyHtml.replace(/D/g, "<span class='card-suit diamond'>\u2666</span>");
entropyHtml = entropyHtml.replace(/H/g, "<span class='card-suit heart'>\u2665</span>");
@@ -154,18 +242,6 @@ window.Entropy = new (function() {
return e;
}
function getSortedDeck() {
var s = [];
var suits = "CDHS";
var values = "A23456789TJQK";
for (var i=0; i<suits.length; i++) {
for (var j=0; j<values.length; j++) {
s.push(values[j]+suits[i]);
}
}
return s;
}
function getBase(str, baseStr) {
// Need to get the lowest base for the supplied entropy.
// This prevents interpreting, say, dice rolls as hexadecimal.
@@ -177,20 +253,21 @@ window.Entropy = new (function() {
var ints = binaryMatches.map(function(i) { return parseInt(i, 2) });
return {
ints: ints,
parts: binaryMatches,
events: binaryMatches,
matcher: matchers.binary,
asInt: 2,
bitsPerEvent: 1,
str: "binary",
}
}
var cardMatches = matchers.card(str);
if ((cardMatches.length >= hexMatches.length / 2 && autodetect) || baseStr === "card") {
var ints = convertCardsToInts(cardMatches);
return {
ints: ints,
parts: cardMatches,
events: cardMatches,
matcher: matchers.card,
asInt: 52,
bitsPerEvent: (32*5 + 16*4 + 4*2) / 52, // see cardBits
str: "card",
}
}
@@ -199,9 +276,10 @@ window.Entropy = new (function() {
var ints = diceMatches.map(function(i) { return parseInt(i) });
return {
ints: ints,
parts: diceMatches,
events: diceMatches,
matcher: matchers.dice,
asInt: 6,
bitsPerEvent: (4*2 + 2*1) / 6, // see diceBits
str: "dice",
}
}
@@ -210,9 +288,10 @@ window.Entropy = new (function() {
var ints = base6Matches.map(function(i) { return parseInt(i) });
return {
ints: ints,
parts: base6Matches,
events: base6Matches,
matcher: matchers.base6,
asInt: 6,
bitsPerEvent: (4*2 + 2*1) / 6, // see diceBits
str: "base 6",
}
}
@@ -221,126 +300,22 @@ window.Entropy = new (function() {
var ints = base10Matches.map(function(i) { return parseInt(i) });
return {
ints: ints,
parts: base10Matches,
events: base10Matches,
matcher: matchers.base10,
asInt: 10,
bitsPerEvent: (8*3 + 2*1) / 10, // see b10Bits
str: "base 10",
}
}
var ints = hexMatches.map(function(i) { return parseInt(i, 16) });
return {
ints: ints,
parts: hexMatches,
events: hexMatches,
matcher: matchers.hex,
asInt: 16,
bitsPerEvent: 4,
str: "hexadecimal",
}
}
// Assume cards are NOT replaced.
// Additional entropy decreases as more cards are used. This means
// total possible entropy is measured using n!, not base^n.
// eg the second last card can be only one of two, not one of fifty two
// so the added entropy for that card is only one bit at most
function processCardEntropy(cards) {
// Track how many instances of each card have been used, and thus
// how many decks are in use.
var cardCounts = {};
var numberOfDecks = 0;
// Work out number of decks by max(duplicates)
for (var i=0; i<cards.length; i++) {
// Get the card that was drawn
var cardLower = cards[i];
var card = cardLower.toUpperCase();
// Initialize the count for this card if needed
if (!(card in cardCounts)) {
cardCounts[card] = 0;
}
cardCounts[card] += 1;
// See if this is max(duplicates)
if (cardCounts[card] > numberOfDecks) {
numberOfDecks = cardCounts[card];
}
}
// Work out the total number of bits for this many decks
// See http://crypto.stackexchange.com/q/41886
var gainedBits = 0;
// Equivalent of Math.log2(factorial(52*numberOfDecks))
// which becomes infinity for numberOfDecks > 4
for (var i=1; i<=52*numberOfDecks; i++) {
gainedBits = gainedBits + Math.log2(i);
}
var lostBits = 52 * Math.log2(factorial(numberOfDecks));
var maxBits = gainedBits - lostBits;
// Convert the drawn cards to a binary representation.
// The exact technique for doing this is unclear.
// See
// http://crypto.stackexchange.com/a/41896
// "I even doubt that this is well defined (only the average entropy
// is, I believe)."
// See
// https://github.com/iancoleman/bip39/issues/33#issuecomment-263021856
// "The binary representation can be the first log(permutations,2) bits
// of the sha-2 hash of the normalized deck string."
//
// In this specific implementation, the first N bits of the hash of the
// normalized cards string is being used. Uppercase, no spaces; eg
// sha256("AH8DQSTC2H")
var totalCards = numberOfDecks * 52;
var percentUsed = cards.length / totalCards;
// Calculate the average number of bits of entropy for the number of
// cards drawn.
var numberOfBits = Math.floor(maxBits * percentUsed);
// Create a normalized string of the selected cards
var normalizedCards = cards.join("").toUpperCase();
// Convert to binary using the SHA256 hash of the normalized cards.
// If the number of bits is more than 256, multiple hashes
// are used until the required number of bits is reached.
var entropyBin = "";
var iterations = 0;
while (entropyBin.length < numberOfBits) {
var hashedCards = sjcl.hash.sha256.hash(normalizedCards + ":" + iterations);
var hashHex = sjcl.codec.hex.fromBits(hashedCards);
for (var i=0; i<hashHex.length; i++) {
var decimal = parseInt(hashHex[i], 16);
var binary = decimal.toString(2);
while (binary.length < 4) {
binary = "0" + binary;
}
entropyBin = entropyBin + binary;
}
iterations = iterations + 1;
}
// Truncate to the appropriate number of bits.
entropyBin = entropyBin.substring(0, numberOfBits);
// Get the number of bits per event
bitsPerEvent = maxBits / totalCards;
return {
binaryStr: entropyBin,
bitsPerEvent: bitsPerEvent,
}
}
// Polyfill for Math.log2
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log2#Polyfill
Math.log2 = Math.log2 || function(x) {
// The polyfill isn't good enough because of the poor accuracy of
// Math.LOG2E
// log2(8) gave 2.9999999999999996 which when floored causes issues.
// So instead use the BigInteger library to get it right.
return libs.BigInteger.BigInteger.log(x) / libs.BigInteger.BigInteger.log(2);
};
// Depends on BigInteger
function factorial(n) {
if (n == 0) {
return 1;
}
f = libs.BigInteger.BigInteger.ONE;
for (var i=1; i<=n; i++) {
f = f.multiply(new libs.BigInteger.BigInteger(i));
}
return f;
}
})();

File diff suppressed because it is too large Load Diff

19
src/js/fio-util.js Normal file
View File

@@ -0,0 +1,19 @@
function FIObufferToPublic(pubBuf) {
const Buffer = libs.buffer.Buffer;
const FIO_PUBLIC_PREFIX = "FIO";
let checksum = libs.createHash("rmd160").update(pubBuf).digest("hex").slice(0, 8);
pubBuf = Buffer.concat([pubBuf, Buffer.from(checksum, "hex")]);
return FIO_PUBLIC_PREFIX.concat(libs.bs58.encode(pubBuf));
}
function FIObufferToPrivate(privBuf) {
const Buffer = libs.buffer.Buffer;
const FIO_PRIVATE_PREFIX = "80";
privBuf = Buffer.concat([Buffer.from(FIO_PRIVATE_PREFIX, "hex"), privBuf]);
let tmp = libs.createHash("sha256").update(privBuf).digest();
let checksum = libs.createHash("sha256").update(tmp).digest("hex").slice(0, 8);
privBuf = Buffer.concat([privBuf, Buffer.from(checksum, "hex")]);
return libs.bs58.encode(privBuf);
}

View File

@@ -47,6 +47,8 @@
DOM.entropyWeakEntropyOverrideWarning = DOM.entropyContainer.find(".weak-entropy-override-warning");
DOM.entropyFilterWarning = DOM.entropyContainer.find(".filter-warning");
DOM.phrase = $(".phrase");
DOM.splitMnemonic = $(".splitMnemonic");
DOM.showSplitMnemonic = $(".showSplitMnemonic");
DOM.phraseSplit = $(".phraseSplit");
DOM.phraseSplitWarn = $(".phraseSplitWarn");
DOM.passphrase = $(".passphrase");
@@ -133,6 +135,7 @@
DOM.entropyMnemonicLength.on("change", entropyChanged);
DOM.entropyTypeInputs.on("change", entropyTypeChanged);
DOM.phrase.on("input", delayedPhraseChanged);
DOM.showSplitMnemonic.on("change", toggleSplitMnemonic);
DOM.passphrase.on("input", delayedPhraseChanged);
DOM.generate.on("click", generateClicked);
DOM.more.on("click", showMore);
@@ -428,6 +431,15 @@
phraseChanged();
}
function toggleSplitMnemonic() {
if (DOM.showSplitMnemonic.prop("checked")) {
DOM.splitMnemonic.removeClass("hidden");
}
else {
DOM.splitMnemonic.addClass("hidden");
}
}
function calcForDerivationPath() {
clearDerivedKeys();
clearAddressesList();
@@ -1139,6 +1151,51 @@
privkey = libs.ethUtil.bufferToHex(keyPair.d.toBuffer());
}
}
//TRX is different
if (networks[DOM.network.val()].name == "TRX - Tron") {
keyPair = new libs.bitcoin.ECPair(keyPair.d, null, { network: network, compressed: false });
var pubkeyBuffer = keyPair.getPublicKeyBuffer();
var ethPubkey = libs.ethUtil.importPublic(pubkeyBuffer);
var addressBuffer = libs.ethUtil.publicToAddress(ethPubkey);
address = libs.bitcoin.address.toBase58Check(addressBuffer, 0x41);
if (hasPrivkey) {
privkey = keyPair.d.toBuffer().toString('hex');
}
}
// RSK values are different
if (networkIsRsk()) {
var pubkeyBuffer = keyPair.getPublicKeyBuffer();
var ethPubkey = libs.ethUtil.importPublic(pubkeyBuffer);
var addressBuffer = libs.ethUtil.publicToAddress(ethPubkey);
var hexAddress = addressBuffer.toString('hex');
// Use chainId based on selected network
// Ref: https://developers.rsk.co/rsk/architecture/account-based/#chainid
var chainId;
var rskNetworkName = networks[DOM.network.val()].name;
switch (rskNetworkName) {
case "R-BTC - RSK":
chainId = 30;
break;
case "tR-BTC - RSK Testnet":
chainId = 31;
break;
default:
chainId = null;
}
var checksumAddress = toChecksumAddressForRsk(hexAddress, chainId);
address = libs.ethUtil.addHexPrefix(checksumAddress);
pubkey = libs.ethUtil.addHexPrefix(pubkey);
if (hasPrivkey) {
privkey = libs.ethUtil.bufferToHex(keyPair.d.toBuffer());
}
}
// Handshake values are different
if (networks[DOM.network.val()].name == "HNS - Handshake") {
var ring = libs.handshake.KeyRing.fromPublic(keyPair.getPublicKeyBuffer())
address = ring.getAddress().toString();
}
// Stellar is different
if (networks[DOM.network.val()].name == "XLM - Stellar") {
@@ -1152,6 +1209,15 @@
privkey = keypair.secret();
pubkey = address = keypair.publicKey();
}
// Nano currency
if (networks[DOM.network.val()].name == "NANO - Nano") {
var nanoKeypair = libs.nanoUtil.getKeypair(index, seed);
privkey = nanoKeypair.privKey;
pubkey = nanoKeypair.pubKey;
address = nanoKeypair.address;
}
if ((networks[DOM.network.val()].name == "NAS - Nebulas")) {
var privKeyBuffer = keyPair.d.toBuffer(32);
var nebulasAccount = libs.nebulas.Account.NewAccount();
@@ -1165,6 +1231,11 @@
privkey = convertRipplePriv(privkey);
address = convertRippleAdrr(address);
}
// Jingtum values are different
if (networks[DOM.network.val()].name == "SWTC - Jingtum") {
privkey = convertJingtumPriv(privkey);
address = convertJingtumAdrr(address);
}
// CasinoCoin values are different
if (networks[DOM.network.val()].name == "CSC - CasinoCoin") {
privkey = convertCasinoCoinPriv(privkey);
@@ -1227,8 +1298,14 @@
if (networks[DOM.network.val()].name == "EOS - EOSIO") {
address = ""
pubkey = eosUtil.bufferToPublic(keyPair.getPublicKeyBuffer());
privkey = eosUtil.bufferToPrivate(keyPair.d.toBuffer(32));
pubkey = EOSbufferToPublic(keyPair.getPublicKeyBuffer());
privkey = EOSbufferToPrivate(keyPair.d.toBuffer(32));
}
if (networks[DOM.network.val()].name == "FIO - Foundation for Interwallet Operability") {
address = ""
pubkey = FIObufferToPublic(keyPair.getPublicKeyBuffer());
privkey = FIObufferToPrivate(keyPair.d.toBuffer(32));
}
//Groestlcoin Addresses are different
@@ -1681,7 +1758,7 @@
var numberOfBits = entropy.binaryStr.length;
var timeToCrack = "unknown";
try {
var z = libs.zxcvbn(entropy.base.parts.join(""));
var z = libs.zxcvbn(entropy.base.events.join(""));
timeToCrack = z.crack_times_display.offline_fast_hashing_1e10_per_second;
if (z.feedback.warning != "") {
timeToCrack = timeToCrack + " - " + z.feedback.warning;
@@ -1700,7 +1777,7 @@
DOM.entropyFiltered.html(entropy.cleanHtml);
DOM.entropyType.text(entropyTypeStr);
DOM.entropyCrackTime.text(timeToCrack);
DOM.entropyEventCount.text(entropy.base.ints.length);
DOM.entropyEventCount.text(entropy.base.events.length);
DOM.entropyBits.text(numberOfBits);
DOM.entropyWordCount.text(wordCount);
DOM.entropyBinary.text(spacedBinaryStr);
@@ -1725,8 +1802,8 @@
// Detect duplicates
var dupes = [];
var dupeTracker = {};
for (var i=0; i<entropy.base.parts.length; i++) {
var card = entropy.base.parts[i];
for (var i=0; i<entropy.base.events.length; i++) {
var card = entropy.base.events[i];
var cardUpper = card.toUpperCase();
if (cardUpper in dupeTracker) {
dupes.push(card);
@@ -1832,6 +1909,7 @@
|| (name == "EWT - EnergyWeb")
|| (name == "PIRL - Pirl")
|| (name == "MIX - MIX")
|| (name == "MOAC - MOAC")
|| (name == "MUSIC - Musicoin")
|| (name == "POA - Poa")
|| (name == "EXP - Expanse")
@@ -1841,6 +1919,13 @@
|| (name == "ESN - Ethersocial Network")
|| (name == "VET - VeChain")
|| (name == "ERE - EtherCore")
|| (name == "BSC - Binance Smart Chain")
}
function networkIsRsk() {
var name = networks[DOM.network.val()].name;
return (name == "R-BTC - RSK")
|| (name == "tR-BTC - RSK Testnet");
}
function networkHasSegwit() {
@@ -2024,6 +2109,13 @@
setHdCoin(161);
},
},
{
name: "AGM - Argoneum",
onSelect: function() {
network = libs.bitcoin.networks.argoneum;
setHdCoin(421);
},
},
{
name: "ARYA - Aryacoin",
onSelect: function() {
@@ -2173,6 +2265,13 @@
setHdCoin(183);
},
},
{
name: "BSC - Binance Smart Chain",
onSelect: function() {
network = libs.bitcoin.networks.bitcoin;
setHdCoin(60);
},
},
{
name: "BSV - BitcoinSV",
onSelect: function() {
@@ -2272,6 +2371,14 @@
setHdCoin(186);
},
},
{
name: "CRP - CranePay",
onSelect: function() {
network = libs.bitcoin.networks.cranepay;
setHdCoin(2304);
},
},
{
name: "CRW - Crown (Legacy)",
onSelect: function() {
@@ -2480,6 +2587,13 @@
setHdCoin(40);
},
},
{
name: "FIO - Foundation for Interwallet Operability",
onSelect: function() {
network = libs.bitcoin.networks.bitcoin;
setHdCoin(235);
},
},
{
name: "FIX - FIX",
onSelect: function() {
@@ -2564,6 +2678,12 @@
setHdCoin(1);
},
},
{
name: "HNS - Handshake",
onSelect: function() {
setHdCoin(5353);
},
},
{
name: "HNC - Helleniccoin",
onSelect: function() {
@@ -2738,6 +2858,14 @@
setHdCoin(214);
},
},
{
name: "MOAC - MOAC",
segwitAvailable: false,
onSelect: function() {
network = libs.bitcoin.networks.bitcoin;
setHdCoin(314);
},
},
{
name: "MUSIC - Musicoin",
segwitAvailable: false,
@@ -2746,6 +2874,13 @@
setHdCoin(184);
},
},
{
name: "NANO - Nano",
onSelect: function() {
network = network = libs.nanoUtil.dummyNetwork;
setHdCoin(165);
},
},
{
name: "NAV - Navcoin",
onSelect: function() {
@@ -2959,16 +3094,16 @@
},
},
{
name: "RBTC - RSK",
name: "R-BTC - RSK",
onSelect: function() {
network = libs.bitcoin.networks.rubycoin;
network = libs.bitcoin.networks.rsk;
setHdCoin(137);
},
},
{
name: "tRBTC - RSK Testnet",
name: "tR-BTC - RSK Testnet",
onSelect: function() {
network = libs.bitcoin.networks.rubycoin;
network = libs.bitcoin.networks.rsktestnet;
setHdCoin(37310);
},
},
@@ -3000,6 +3135,13 @@
setHdCoin(19165);
},
},
{
name: "SCRIBE - Scribe",
onSelect: function() {
network = libs.bitcoin.networks.scribe;
setHdCoin(545);
},
},
{
name: "SLS - Salus",
onSelect: function() {
@@ -3077,6 +3219,27 @@
setHdCoin(105);
},
},
{
name: "SUGAR - Sugarchain",
onSelect: function() {
network = libs.bitcoin.networks.sugarchain;
setHdCoin(408);
},
},
{
name: "TUGAR - Sugarchain Testnet",
onSelect: function() {
network = libs.bitcoin.networks.sugarchaintestnet;
setHdCoin(408);
},
},
{
name: "SWTC - Jingtum",
onSelect: function() {
network = libs.bitcoin.networks.bitcoin;
setHdCoin(315);
},
},
{
name: "TSTRAT - Stratis Testnet",
onSelect: function() {
@@ -3112,6 +3275,12 @@
setHdCoin(159);
},
},
{
name: "TRX - Tron",
onSelect: function() {
setHdCoin(195);
},
},
{
name: "TWINS - TWINS",
onSelect: function() {
@@ -3328,6 +3497,46 @@
}
]
// RSK - RSK functions - begin
function stripHexPrefix(address) {
if (typeof address !== "string") {
throw new Error("address parameter should be a string.");
}
var hasPrefix = (address.substring(0, 2) === "0x" ||
address.substring(0, 2) === "0X");
return hasPrefix ? address.slice(2) : address;
};
function toChecksumAddressForRsk(address, chainId = null) {
if (typeof address !== "string") {
throw new Error("address parameter should be a string.");
}
if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) {
throw new Error("Given address is not a valid RSK address: " + address);
}
var stripAddress = stripHexPrefix(address).toLowerCase();
var prefix = chainId != null ? chainId.toString() + "0x" : "";
var keccakHash = libs.ethUtil.keccak256(prefix + stripAddress)
.toString("hex")
.replace(/^0x/i, "");
var checksumAddress = "0x";
for (var i = 0; i < stripAddress.length; i++) {
checksumAddress +=
parseInt(keccakHash[i], 16) >= 8 ?
stripAddress[i].toUpperCase() :
stripAddress[i];
}
return checksumAddress;
}
// RSK - RSK functions - end
// ELA - Elastos functions - begin
function displayBip44InfoForELA() {
if (!isELA()) {

10
src/js/jingtum-util.js Normal file
View File

@@ -0,0 +1,10 @@
function convertJingtumAdrr(address) {
return libs.basex('jpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65rkm8oFqi1tuvAxyz').encode(
libs.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(address)
)
}
function convertJingtumPriv(priv) {
return libs.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(priv).toString("hex").slice(2,66)
}

View File

@@ -163,6 +163,36 @@ libs.bitcoin.networks.regtest.p2wshInP2sh = {
scriptHash: 0xc4,
wif: 0xef
};
libs.bitcoin.networks.cranepay.p2wpkhInP2sh = {
baseNetwork: "cranepay",
messagePrefix: '\x18Bitcoin Signed Message:\n',
bech32: 'cp',
bip32: {
public: 0x049d7cb2,
private: 0x049d7878
},
pubKeyHash: 28,
scriptHash: 10,
wif: 123
};
// bech32
libs.bitcoin.networks.cranepay.p2wpkh = {
baseNetwork: "cranepay",
messagePrefix: '\x18Bitcoin Signed Message:\n',
bech32: 'cp',
bip32: {
public: 0x04b24746,
private: 0x04b2430c
},
pubKeyHash: 28,
scriptHash: 10,
wif: 123
};
libs.bitcoin.networks.litecoin.p2wpkh = {
baseNetwork: "litecoin",
@@ -452,7 +482,7 @@ libs.bitcoin.networks.bitcore.p2wpkhInP2sh = {
libs.bitcoin.networks.monacoin.p2wpkh = {
baseNetwork: "monacoin",
messagePrefix: '\x18Monacoin Signed Message:\n',
bech32: 'monacoin',
bech32: 'mona',
bip32: {
public: 0x0488b21e,
private: 0x0488ade4
@@ -465,7 +495,7 @@ libs.bitcoin.networks.monacoin.p2wpkh = {
libs.bitcoin.networks.monacoin.p2wpkhInP2sh = {
baseNetwork: "monacoin",
messagePrefix: '\x18Monacoin Signed Message:\n',
bech32: 'monacoin',
bech32: 'mona',
bip32: {
public: 0x0488b21e,
private: 0x0488ade4
@@ -683,4 +713,56 @@ libs.bitcoin.networks.deeponion.p2wpkhInP2sh = {
wif: 0x9f
};
libs.bitcoin.networks.sugarchain.p2wpkh = {
baseNetwork: "sugarchain",
messagePrefix: '\x1DSugarchain Signed Message:\n',
bech32: 'sugar',
bip32: {
public: 0x04b24746,
private: 0x04b2430c
},
pubKeyHash: 0x3f,
scriptHash: 0x7d,
wif: 0x80
};
libs.bitcoin.networks.sugarchain.p2wpkhInP2sh = {
baseNetwork: "sugarchain",
messagePrefix: '\x1DSugarchain Signed Message:\n',
bech32: 'sugar',
bip32: {
public: 0x049d7cb2,
private: 0x049d7878
},
pubKeyHash: 0x3f,
scriptHash: 0x7d,
wif: 0x80
};
libs.bitcoin.networks.sugarchaintestnet.p2wpkh = {
baseNetwork: "sugarchaintestnet",
messagePrefix: '\x18Sugarchain Signed Message:\n',
bech32: 'tugar',
bip32: {
public: 0x045f1cf6,
private: 0x045f18bc
},
pubKeyHash: 0x42,
scriptHash: 0x80,
wif: 0xef
};
libs.bitcoin.networks.sugarchaintestnet.p2wpkhInP2sh = {
baseNetwork: "sugarchaintestnet",
messagePrefix: '\x18Sugarchain Signed Message:\n',
bech32: 'tugar',
bip32: {
public: 0x044a5262,
private: 0x044a4e28
},
pubKeyHash: 0x42,
scriptHash: 0x80,
wif: 0xef
};
})();

View File

@@ -464,6 +464,16 @@ it('Allows selection of ripple', function(done) {
};
testNetwork(done, params);
});
it('Allows selection of jingtum', function(done) {
var params = {
selectText: "SWTC - Jingtum",
phrase: "ill clump only blind unit burden thing track silver cloth review awake useful craft whale all satisfy else trophy sunset walk vanish hope valve",
firstAddress: "jffSYWyxcr9t6DHHdAj2yUXrCsioU66xjm",
firstPubKey: "029dfcb278148874dd7e7109001593d7f410909e7bbcbcc3cc19ecb476c8bf8d84",
firstPrivKey: "02bdfe14bdd75514e714db7b8cbbae87b2ab8d7a050c3e441d687b7c4ef17d1f",
};
testNetwork(done, params);
});
it('Allows selection of casinocoin', function(done) {
var params = {
selectText: "CSC - CasinoCoin",
@@ -1195,6 +1205,15 @@ it('Allows selection of Feathercoin', function(done) {
};
testNetwork(done, params);
});
it('Allows selection of FIO', function(done) {
var params = {
selectText: "FIO - Foundation for Interwallet Operability",
phrase: "valley alien library bread worry brother bundle hammer loyal barely dune brave",
firstPubKey: "FIO5kJKNHwctcfUM5XZyiWSqSTM5HTzznJP9F3ZdbhaQAHEVq575o",
firstPrivKey: "5Kbb37EAqQgZ9vWUHoPiC2uXYhyGSFNbL6oiDp24Ea1ADxV1qnu",
};
testNetwork(done, params);
});
it('Allows selection of Firstcoin', function(done) {
var params = {
selectText: "FRST - Firstcoin",
@@ -1665,6 +1684,26 @@ it('Allows selection of Stratis Test', function(done) {
};
testNetwork(done, params);
});
it('Allows selection of Sugarchain', function(done) {
var params = {
selectText: "SUGAR - Sugarchain",
phrase: "abandon abandon ability",
firstAddress: "SYnd31fYr39VgKju87Vz1sYBmEeHg5cudk",
firstPubKey: "035bc9fa22eff2246ec07bb09c9e32f5f9fee517b4f49a8f117508f8fb41905b25",
firstPrivKey: "L2G3axGdZv5EV8osAsBPMese74i4dTHaGvxDh7DsRF5Ky6hKkPDY",
};
testNetwork(done, params);
});
it('Allows selection of Sugarchain Testnet', function(done) {
var params = {
selectText: "TUGAR - Sugarchain Testnet",
phrase: "abandon abandon ability",
firstAddress: "TkoRzLZQyaY88dAACNVwUFMYekR7pv6CbY",
firstPubKey: "035bc9fa22eff2246ec07bb09c9e32f5f9fee517b4f49a8f117508f8fb41905b25",
firstPrivKey: "cSd33sGUzymVeaH8ZGzWiyNhjJ1UHuPGLy6goXgNvMjLDqioARWW",
};
testNetwork(done, params);
});
it('Allows selection of Syscoin', function(done) {
var params = {
selectText: "SYS - Syscoin",
@@ -1896,6 +1935,16 @@ it('Allows selection of Monkey Project', function(done) {
testNetwork(done, params);
});
it('Allows selection of MOAC', function(done) {
var params = {
selectText: "MOAC - MOAC",
phrase: "ill clump only blind unit burden thing track silver cloth review awake useful craft whale all satisfy else trophy sunset walk vanish hope valve",
firstAddress: "0xa1350EA5707247e0092Ab780A0CDbeA9c8C7Acb5",
firstPubKey: "0x0376b024c6068c9fda7e91779e115dcd3a70584fd6984e6dd25da144c46ca259c6",
firstPrivKey: "0x2515f9db03c1e56de393648eabf35d288f730aadce5d30865c52e72b28e303c9",
};
testNetwork(done, params);
});
it('Allows selection of Musicoin', function(done) {
var params = {
selectText: "MUSIC - Musicoin",
@@ -2106,6 +2155,16 @@ it('Allows selection of Stellar', function(done) {
};
testNetwork(done, params);
});
it('Allows selection of Nano', function(done) {
var params = {
selectText: "NANO - Nano",
phrase: "deal wedding panda forum property artist whip total word student sea middle",
firstAddress: "nano_15fum9n68681dz73qyu37fuc9tro84gqm86eptdqpm9jutkfnt34agkoqpw5",
firstPubKey: "0dbb99e84310c05fca1bfb612b76a3eb15309d79988cb6977b4cf1dea4da6822",
firstPrivKey: "30633c8497cc47e0aefd52c7971ffd45e6c5d166274c7978feca3482a859c0af",
};
testNetwork(done, params);
});
it('Allows selection of Wagerr', function(done) {
var params = {
selectText: "WGR - Wagerr",
@@ -2178,21 +2237,72 @@ it('Allows selection of EtherCore', function(done) {
});
it('Allows selection of RBTC - RSK', function(done) {
var params = {
selectText: "RBTC - RSK",
selectText: "R-BTC - RSK",
phrase: "abandon abandon ability",
firstAddress: "RGtz5TDdtviAZ9haz1YAUNQzcGVFm5bQrP",
firstPubKey: "0219d9b5087ab68edc8a714969d8cb70e7159417b47a05932b227e6f417c7962b9",
firstPrivKey: "UsiDPMcpYqCwtzGXo4wiPZp7cwBaKdmbmseioTc1rFQsg21adFc8",
firstAddress: "0x37CA764c4b2fe819108448b80d2F35921b035931",
firstPubKey: "0x0219d9b5087ab68edc8a714969d8cb70e7159417b47a05932b227e6f417c7962b9",
firstPrivKey: "0x6e6f48cc422825f7fd68f2200d3dde757849f15342f252eeb0bc4ebc46089fe1",
};
testNetwork(done, params);
});
it('Allows selection of tRBTC - RSK Testnet', function(done) {
var params = {
selectText: "tRBTC - RSK Testnet",
selectText: "tR-BTC - RSK Testnet",
phrase: "abandon abandon ability",
firstAddress: "RHkrWgnSdJHxQAqEsMErhUUa4icXY6xUUC",
firstPubKey: "03f77eb7bd83e92ef47be1abddae7f71fb0bc8a7a1ee4b193662a86ed2705ffc5b",
firstPrivKey: "UpqfuSEDKoacrPh4wMV4sJZqCB6DJfYe81oWBr4eb7y9FWQWoo2A",
firstAddress: "0x176484B5a155Fe802aCB26055eb1c193D5A576d5",
firstPubKey: "0x03f77eb7bd83e92ef47be1abddae7f71fb0bc8a7a1ee4b193662a86ed2705ffc5b",
firstPrivKey: "0x18c2400d2f818d28b80d0e31235873bfeef644fc45fd702f54ae0d422cff6ab3",
};
testNetwork(done, params);
});
it('Allows selection of Argoneum', function(done) {
var params = {
selectText: "AGM - Argoneum",
phrase: "abandon abandon ability",
firstAddress: "MWgLPvJkaJwH6hrXFs1MimAC4FwC1kYRhe",
firstPubKey: "0348e5252045fee1d3b1e5bce25dbc16284d5b6c3bfff9c305d4ffa6078c16f3f8",
firstPrivKey: "VJXpuMEFnK8USLyo5tgF7M4cBXU44U8MUor1KRTQ6t9DVno9AAgg",
};
testNetwork(done, params);
});
it('Allows selection of CranePay', function(done) {
var params = {
selectText: "CRP - CranePay",
phrase: "abandon abandon ability",
firstAddress: "CcUHPqgmef1BmgWFa9g3YNc8scgVXVh8ip",
firstPubKey: "0392af9ea9dc78170c6f68c50bac926f960e50769295f539ac6382a3af2b928740",
firstPrivKey: "KHTCAvKHKg1WdLoDSg3VjjyZK5Wk1ihzJENpp2YMb1RmAxrCZrXX",
};
testNetwork(done, params);
});
it('Allows selection of Scribe', function(done) {
var params = {
selectText: "SCRIBE - Scribe",
phrase: "abandon abandon ability",
firstAddress: "RYAnPeBLD8veZ9Tw8xugeTC2f9PeZonLHM",
firstPubKey: "02c912bc4759c8a209475502fb5352ff5be8a8f13eb72f1732ee25125cd53edc1e",
firstPrivKey: "HLZWvNCEUv4ghygjH9A2EYCa9HNRcxe5CS42kzUTmoxJYp3z96QE",
};
testNetwork(done, params);
});
it('Allows selection of Binance Smart Chain', function(done) {
var params = {
selectText: "BSC - Binance Smart Chain",
phrase: "abandon abandon ability",
firstAddress: "0xe5815d5902Ad612d49283DEdEc02100Bd44C2772",
firstPubKey: "0x03e723e5b3aa7d72213f01139aa4783e1b34f74e1a04534e3fd8e29bfe2768af8a",
firstPrivKey: "0x8f253078b73d7498302bb78c171b23ce7a8fb511987d2b2702b731638a4a15e7",
};
testNetwork(done, params);
});
it('Allows selection of TRX on Tron', function(done) {
var params = {
selectText: "TRX - Tron",
phrase: "abandon abandon ability",
firstAddress: "TA891Fu7vVz595BGQpNX2MCzr7yBcxuoC7",
firstPubKey: "0337bbb060e6166066f7f9e59e52f67bc23a6c9d0cbc815b82b6d89112444842e7",
firstPrivKey: "3a8fbd0379a815764979de86a3fcda759cb62d49e784e7b2a9a03206c90cfae2",
};
testNetwork(done, params);
});
@@ -3041,7 +3151,7 @@ it("Shows the number of bits of entropy for 4 bits of binary", function(done) {
testEntropyBits(done, "0000", "4");
});
it("Shows the number of bits of entropy for 1 character of base 6 (dice)", function(done) {
// 6 in card is 0 in base 6, 0 in base 6 is 2.6 bits (rounded down to 2 bits)
// 6 in card is 0 in base 6, 0 is mapped to 00 by entropy.js
testEntropyBits(done, "6", "2");
});
it("Shows the number of bits of entropy for 1 character of base 10 with 3 bits", function(done) {
@@ -3049,13 +3159,15 @@ it("Shows the number of bits of entropy for 1 character of base 10 with 3 bits",
testEntropyBits(done, "7", "3");
});
it("Shows the number of bits of entropy for 1 character of base 10 with 4 bis", function(done) {
testEntropyBits(done, "8", "4");
// 8 in base 10 is mapped to 0 by entropy.js
testEntropyBits(done, "8", "1");
});
it("Shows the number of bits of entropy for 1 character of hex", function(done) {
testEntropyBits(done, "F", "4");
});
it("Shows the number of bits of entropy for 2 characters of base 10", function(done) {
testEntropyBits(done, "29", "6");
// 2 as base 10 is binary 010, 9 is mapped to binary 1 by entropy.js
testEntropyBits(done, "29", "4");
});
it("Shows the number of bits of entropy for 2 characters of hex", function(done) {
testEntropyBits(done, "0A", "8");
@@ -3080,17 +3192,17 @@ it("Shows the number of bits of entropy for 4 characters of hex with leading zer
testEntropyBits(done, "000A", "16");
});
it("Shows the number of bits of entropy for 4 characters of base 6", function(done) {
testEntropyBits(done, "5555", "11");
// 5 in base 6 is mapped to binary 1
testEntropyBits(done, "5555", "4");
});
it("Shows the number of bits of entropy for 4 characters of base 6 dice", function(done) {
// uses dice, so entropy is actually 0000 in base 6, which is 4 lots of
// 2.58 bits, which is 10.32 bits (rounded down to 10 bits)
testEntropyBits(done, "6666", "10");
// binary 00
testEntropyBits(done, "6666", "8");
});
it("Shows the number of bits of entropy for 4 charactes of base 10", function(done) {
// Uses base 10, which is 4 lots of 3.32 bits, which is 13.3 bits (rounded
// down to 13)
testEntropyBits(done, "2227", "13");
// 2 in base 10 is binary 010 and 7 is binary 111 so is 4 events of 3 bits
testEntropyBits(done, "2227", "12");
});
it("Shows the number of bits of entropy for 4 characters of hex with 2 leading zeros", function(done) {
testEntropyBits(done, "222F", "16");
@@ -3099,13 +3211,16 @@ it("Shows the number of bits of entropy for 4 characters of hex starting with F"
testEntropyBits(done, "FFFF", "16");
});
it("Shows the number of bits of entropy for 10 characters of base 10", function(done) {
// 10 events at 3.32 bits per event
testEntropyBits(done, "0000101017", "33");
// 10 events with 3 bits for each event
testEntropyBits(done, "0000101017", "30");
});
it("Shows the number of bits of entropy for 10 characters of base 10 account for bias", function(done) {
// 9 events with 3 bits per event and 1 event with 1 bit per event
testEntropyBits(done, "0000101018", "28");
});
it("Shows the number of bits of entropy for a full deck of cards", function(done) {
// cards are not replaced, so a full deck is not 52^52 entropy which is 296
// bits, it's 52!, which is 225 bits
testEntropyBits(done, "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks", "225");
// removing bias is 32*5 + 16*4 + 4*2
testEntropyBits(done, "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks", "232");
});
it("Shows details about the entered entropy", function(done) {
@@ -3231,7 +3346,7 @@ it("Shows details about the entered entropy", function(done) {
entropy: "7d",
type: "card",
events: "1",
bits: "4",
bits: "5",
words: 0,
strength: "less than a second",
}
@@ -3243,7 +3358,7 @@ it("Shows details about the entered entropy", function(done) {
entropy: "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks",
type: "card (full deck)",
events: "52",
bits: "225",
bits: "232",
words: 21,
strength: "centuries",
}
@@ -3255,7 +3370,7 @@ it("Shows details about the entered entropy", function(done) {
entropy: "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks3d",
type: "card (full deck, 1 duplicate: 3d)",
events: "53",
bits: "254",
bits: "237",
words: 21,
strength: "centuries",
}
@@ -3267,7 +3382,7 @@ it("Shows details about the entered entropy", function(done) {
entropy: "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqs3d4d",
type: "card (2 duplicates: 3d 4d, 1 missing: KS)",
events: "53",
bits: "254",
bits: "240",
words: 21,
strength: "centuries",
}
@@ -3279,8 +3394,8 @@ it("Shows details about the entered entropy", function(done) {
entropy: "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqs3d4d5d6d",
type: "card (4 duplicates: 3d 4d 5d..., 1 missing: KS)",
events: "55",
bits: "264",
words: 24,
bits: "250",
words: 21,
strength: "centuries",
}
);
@@ -3288,13 +3403,12 @@ it("Shows details about the entered entropy", function(done) {
it("Shows details about the entered entropy", function(done) {
testEntropyFeedback(done,
// Next test was throwing uncaught error in zxcvbn
// Also tests 451 bits, ie Math.log2(52!)*2 = 225.58 * 2
{
entropy: "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsksac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks",
type: "card (full deck, 52 duplicates: ac 2c 3c...)",
events: "104",
bits: "499",
words: 45,
bits: "464",
words: 42,
strength: "centuries",
}
);
@@ -3306,7 +3420,7 @@ it("Shows details about the entered entropy", function(done) {
entropy: "asAS",
type: "card (1 duplicate: AS)",
events: "2",
bits: "9",
bits: "8",
words: 0,
strength: "less than a second",
}
@@ -3318,7 +3432,7 @@ it("Shows details about the entered entropy", function(done) {
entropy: "ASas",
type: "card (1 duplicate: as)",
events: "2",
bits: "9",
bits: "8",
words: 0,
strength: "less than a second",
}
@@ -3331,8 +3445,8 @@ it("Shows details about the entered entropy", function(done) {
entropy: "ac2c3c4c5c6c7c8c tcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks",
type: "card (1 missing: 9C)",
events: "51",
bits: "221",
words: 18,
bits: "227",
words: 21,
strength: "centuries",
}
);
@@ -3343,7 +3457,7 @@ it("Shows details about the entered entropy", function(done) {
entropy: "ac2c3c4c5c6c7c8c tcjcqckcad2d3d4d 6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks",
type: "card (2 missing: 9C 5D)",
events: "50",
bits: "216",
bits: "222",
words: 18,
strength: "centuries",
}
@@ -3355,7 +3469,7 @@ it("Shows details about the entered entropy", function(done) {
entropy: "ac2c3c4c5c6c7c8c tcjcqckcad2d3d4d 6d7d8d9dtdjd kdah2h3h 5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks",
type: "card (4 missing: 9C 5D QD...)",
events: "48",
bits: "208",
bits: "212",
words: 18,
strength: "centuries",
}
@@ -3368,20 +3482,21 @@ it("Shows details about the entered entropy", function(done) {
entropy: "ac2c3c4c5c6c7c8c tcjcqckcad2d3d4d 6d 8d9d jd kdah2h3h 5h6h7h8h9hthjhqhkh 2s3s4s5s6s7s8s9stsjsqsks",
type: "card",
events: "45",
bits: "195",
bits: "198",
words: 18,
strength: "centuries",
}
);
});
it("Shows details about the entered entropy", function(done) {
// multiple decks does not affect the bits per event
// since the bits are hardcoded in entropy.js
testEntropyFeedback(done,
// Multiple decks of cards increases bits per event
{
entropy: "3d",
events: "1",
bits: "4",
bitsPerEvent: "4.34",
bits: "5",
bitsPerEvent: "4.46",
}
);
});
@@ -3390,8 +3505,8 @@ it("Shows details about the entered entropy", function(done) {
{
entropy: "3d3d",
events: "2",
bits: "9",
bitsPerEvent: "4.80",
bits: "10",
bitsPerEvent: "4.46",
}
);
});
@@ -3401,7 +3516,7 @@ it("Shows details about the entered entropy", function(done) {
entropy: "3d3d3d",
events: "3",
bits: "15",
bitsPerEvent: "5.01",
bitsPerEvent: "4.46",
}
);
});
@@ -3411,7 +3526,7 @@ it("Shows details about the entered entropy", function(done) {
entropy: "3d3d3d3d",
events: "4",
bits: "20",
bitsPerEvent: "5.14",
bitsPerEvent: "4.46",
}
);
});
@@ -3420,8 +3535,8 @@ it("Shows details about the entered entropy", function(done) {
{
entropy: "3d3d3d3d3d",
events: "5",
bits: "26",
bitsPerEvent: "5.22",
bits: "25",
bitsPerEvent: "4.46",
}
);
});
@@ -3430,8 +3545,8 @@ it("Shows details about the entered entropy", function(done) {
{
entropy: "3d3d3d3d3d3d",
events: "6",
bits: "31",
bitsPerEvent: "5.28",
bits: "30",
bitsPerEvent: "4.46",
}
);
});
@@ -3440,8 +3555,8 @@ it("Shows details about the entered entropy", function(done) {
{
entropy: "3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d",
events: "33",
bits: "184",
bitsPerEvent: "5.59",
bits: "165",
bitsPerEvent: "4.46",
strength: 'less than a second - Repeats like "abcabcabc" are only slightly harder to guess than "abc"',
}
);
@@ -3492,10 +3607,11 @@ it('Converts very long entropy to very long mnemonics', function(done) {
// https://bip32jp.github.io/english/index.html
// NOTES:
// Is incompatible with:
// base 6
// base 20
it('Is compatible with bip32jp.github.io', function(done) {
var entropy = "543210543210543210543210543210543210543210543210543210543210543210543210543210543210543210543210543";
var expectedPhrase = "train then jungle barely whip fiber purpose puppy eagle cloud clump hospital robot brave balcony utility detect estate old green desk skill multiply virus";
var entropy = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
var expectedPhrase = "primary fetch primary fetch primary fetch primary fetch primary fetch primary fetch primary fetch primary fetch primary fetch primary fetch primary fetch primary foster";
driver.findElement(By.css('.use-entropy'))
.click();
driver.findElement(By.css('.entropy'))