├── .gitignore ├── LICENSE ├── changelog.md ├── compile.py ├── dev_env_setup.sh ├── libs ├── base-x │ ├── LICENSE.md │ ├── package.json │ ├── readme.md │ ├── ts_src │ │ └── index.ts │ └── tsconfig.json ├── bitcoinjs-bip38 │ ├── index.js │ ├── package.json │ └── readme.md ├── bitcoinjs-lib │ ├── bitcoinjs-lib.js │ ├── package.json │ └── readme.md ├── combined │ ├── index.js │ ├── package-lock.json │ ├── package.json │ └── readme.md ├── ethereumjs-util │ ├── index.js │ ├── package.json │ └── readme.md ├── nanocurrency-web │ ├── nano-util.js │ ├── package-lock.json │ ├── package.json │ └── readme.md └── stellar-util │ ├── package-lock.json │ ├── package.json │ ├── readme.md │ └── stellar-util.js ├── readme.md ├── release_process.md ├── src ├── css │ ├── app.css │ ├── bootstrap.css │ └── bootstrap.css.map ├── index.html └── js │ ├── bip39-libs.js │ ├── bitcoinjs-extensions.js │ ├── bootstrap.js │ ├── casinocoin-util.js │ ├── cosmos-util.js │ ├── entropy.js │ ├── eos-util.js │ ├── fio-util.js │ ├── index.js │ ├── jingtum-util.js │ ├── jquery-3.2.1.js │ ├── jsbip39.js │ ├── ripple-util.js │ ├── segwit-parameters.js │ ├── sjcl-bip39.js │ ├── wordlist_chinese_simplified.js │ ├── wordlist_chinese_traditional.js │ ├── wordlist_czech.js │ ├── wordlist_english.js │ ├── wordlist_french.js │ ├── wordlist_italian.js │ ├── wordlist_japanese.js │ ├── wordlist_korean.js │ ├── wordlist_portuguese.js │ ├── wordlist_spanish.js │ └── xwc-util.js └── tests ├── package-lock.json ├── package.json └── spec ├── support └── jasmine.json └── tests.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | bip39-standalone.html 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright (c) 2014-2016 Ian Coleman 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | # 0.5.6 2 | 3 | * Add warning to not share info from the page 4 | 5 | # 0.5.5 6 | 7 | * Fix BIP85 bug when pressing enter 8 | 9 | # 0.5.4 10 | 11 | * Add Particl network 12 | * Add Divi network 13 | * Add option to turn autocompute on / off 14 | * Add option to set custom number of pbkdf2 rounds 15 | * Fix blank mnemonic errors when using only seed 16 | 17 | # 0.5.3 18 | 19 | Add Starname network 20 | Add Terra network 21 | Add Bitcoin Private network 22 | Add Thorchain network 23 | Change Xwc network to Xwcc and add new Xwc 24 | Fix Bip85 works without mnemonic (using xprv) 25 | Fix extended key not updating when switching tabs 26 | Fix incorrect html closing tag 27 | 28 | # 0.5.2 29 | 30 | * Show ethereum private keys with correct padding 31 | 32 | # 0.5.1 33 | 34 | * Add Portuguese language 35 | * Add BIP85 36 | * Add Ritocoin 37 | * Add Cosmos Hub 38 | * Add ZooBC 39 | * Add Zcoin/Firo rebranded coin 40 | * Update Namecoin WIF 41 | 42 | # 0.5.0 43 | 44 | * Remove bias from base 6 and base 10 entropy 45 | * Add notes about card entropy 46 | * Hide/show split mnemonic cards 47 | * Fix link to standalone release file 48 | * Add Scribe network 49 | * Add Nano network 50 | * Add TRX network 51 | * Add Binance Smart Chain network 52 | * Clean up dependencies for eos-util 53 | * Update bootstrap to 3.4.1 54 | * Bump library versions 55 | 56 | # 0.4.3 57 | 58 | * Add FIO - Foundation for Interwallet Operability 59 | * Add Argoneum 60 | * Add CranePay 61 | * Add Jingtum network 62 | * Add MOAC 63 | * Update RSK network 64 | * Add HandShake 65 | * Add Sugarchain testnet 66 | * Fix wording "is a checksum" / "contains a checksum" 67 | * Fix bech32 prefix for monacoin 68 | 69 | # 0.4.2 70 | 71 | * Fix ethereum private key format 72 | 73 | # 0.4.1 74 | 75 | * Fix no loading on chrome with third-party cookies blocked 76 | * Add EtherCore 77 | * Add RSK network 78 | * Add DeepOnion segwit parameters 79 | * Fix ethereum xpub derivation 80 | 81 | # 0.4.0 82 | 83 | * Third party libraries deduplicated and minified 84 | * Add text reminder for multibit wallet change addresses 85 | * Seed field can be edited 86 | * Add bitcoin regtest parameters 87 | * Mnemonic conversion to entropy is hex encoded instead of binary 88 | * Entropy type can be manually selected 89 | * Add Bitcoin P2WSH and P2WSH-P2SH 90 | * Add Czech language 91 | 92 | # 0.3.14 93 | 94 | * Ethereum uses standard BIP44 as per majority of wallets (Issue 378) 95 | 96 | # 0.3.13 97 | 98 | * Add Thought network 99 | * Add Energyweb network 100 | * Add Elastos network 101 | * Add Groestlcoin 102 | * Fix for syscoin network 103 | * Add BSV, RPD, MONKEY, ARYA 104 | * Rename Zencash to Horizen 105 | * Update Hush network 106 | * Add CasinoCoin 107 | * Add CPUchain 108 | * Add Wagerr 109 | * Add VeChain 110 | * Option to not use 'change' field for ethereum networks in bip45 111 | * Add segwit parameters for MONKEY, BCA, BTC, MONA, SYS, VIA, DOGEt, LTCt 112 | * Convert mnemonic back to raw entropy 113 | * Add 2-of-3 phrase cards 114 | * Move position of hardened addresses checkbox to address table 115 | 116 | # 0.3.12 117 | 118 | * Fix typos 119 | * Fix DigiByte signing message 120 | * Add DeepOnion network 121 | * Add EOS network 122 | * Add LTC testnetwork 123 | * Add DOGE testnetwork 124 | * Add Stellar network 125 | * Add TWINS network 126 | * Add FIX network 127 | 128 | # 0.3.11 129 | 130 | * Add NIX network 131 | * Fix coin parameters for NMC, XMY, CLAM, ONX, LKR 132 | * Add DEXON network 133 | * Add Nebulas network 134 | * Add LSP network 135 | * Fix Crown network address format 136 | * Add Ellaism network 137 | * Add Etheresocial network 138 | * Add Bolivarcoin network 139 | * Force spellcheck and autocomplete to be off 140 | 141 | # 0.3.10 142 | 143 | * Add Phore network 144 | * Add Blocknode network 145 | * Add Ravencoin network 146 | * Add Safecoin network 147 | * Add LitecoinZ network 148 | * Add LKRcoin network 149 | * Update Peercoin scripthash parameter 150 | * Add Blockstamp network 151 | * Remove old info regarding use of private keys 152 | 153 | # 0.3.9 154 | 155 | * Update BTG signing message 156 | * Add segwit parameters for BTG 157 | * Add segwit parameters for DigiByte 158 | * Add Stash network (see 0.3.8s below) 159 | * Add Salus network 160 | * Add Cryptoescudo network 161 | * Add ExchangeCoin network 162 | * Add Artax network 163 | * Add BitCloud network 164 | * Add Megacoin network 165 | * Add Bitcoin Green network 166 | * Add ANON network 167 | * Add ProjectCoin network 168 | * Reword the 'generate' inputs and words 169 | * Add note for running http server in python 2 170 | * Adjust test to run reliably on slow computers 171 | 172 | # 0.3.8s 173 | 174 | * Add Stash network 175 | 176 | # 0.3.8 177 | 178 | * Add p2wpkh for litecoin 179 | * Add more networks - TSTRAT, Hush, ETC, PIRL, CLO, MIX, MUSIC, POA, EXP 180 | * Add coinomi/ledger client to BIP32 tab 181 | * Fix SYSCOIN and BTX parameters 182 | * Remove bip39-standalone.html from repository 183 | * Remove duplicate id properties on html elements 184 | 185 | # 0.3.7 186 | 187 | * Update AXE network parameters 188 | * Add new networks - Xuez, BTCP, BTCZ, ZCL, ZEN 189 | * Add litecoin bech32 params 190 | * Fix BIP38 for altcoins 191 | * Fix missing span closing tag 192 | * Add indicator to UI for when BIP84 is unavailable 193 | * Replace hasSegwit variable with test for segwit params 194 | * Allow xpub to be used as root key for segwit derivations 195 | * Add visual privacy safeguard 196 | 197 | # 0.3.6 198 | 199 | * Add Kobocoin 200 | * Update Vertcoin version byte and segwit support 201 | * Add Zcash 202 | * Korean mnemonics use ascii spaces 203 | * Add CashAddr address format for bitcoin cash 204 | 205 | # 0.3.5 206 | 207 | * Fix typo 208 | * Add Neblio network 209 | * Update bitcoinjs-lib from 3.3.0 to 3.3.2 210 | * Add Beetle Coin 211 | * Add segwit for bitcoin testnet and Fujicoin 212 | * Set coin number for Bitcoin God to 156 213 | * Add coins supported by coinomi 214 | * Warn when generating low entropy mnemonics 215 | * Warn when overriding weak entropy with a strong mnemonic length 216 | 217 | # 0.3.4 218 | 219 | * Add BlackCoin 220 | * Add Denarius 221 | * Raw entropy shows groupings with space every 11 bits 222 | * Checksum shown in entropy details 223 | * Warn that entropy values should exclude checksum 224 | * Add Korean language 225 | 226 | # 0.3.3 227 | 228 | * Add AXE network 229 | * Ethereum private key generation bugfix 230 | * Add BIP38 support 231 | * Allow initial number of rows to be set by the user 232 | 233 | # 0.3.2 234 | 235 | * Add Onixcoin 236 | * Add Komodo 237 | * BIP84 tab for derivation path 238 | * CSV tab for derived addresses 239 | 240 | # 0.3.1 241 | 242 | * Populate entropy field with hex value used from PRNG 243 | * Show list of word indexes 244 | * Fix typos 245 | * Update jquery from 2.1.1 to 3.2.1 246 | * Update bootstrap from 3.2.0 to 3.3.7 247 | * Move application-specific css into own file 248 | * QR codes with accents work correctly by replacing jquery.qrcode with kjua 249 | 250 | # 0.3.0 251 | 252 | * Update bitcoinjs from 3.1.1 to 3.3.0 253 | * Litecoin defaults to ltub instead of xpub 254 | * Segwit option removed from bip32 tab 255 | * BIP141 tab added for full segwit compatibility 256 | 257 | # 0.2.9 258 | 259 | * Update links from old site to new site 260 | * Add Monacoin 261 | * Add Bitcoin Gold 262 | * Port test suite to selenium 263 | * Allow more rows to be generated starting from a custom index 264 | 265 | # 0.2.8 266 | 267 | * Enable segwit for Litecoin 268 | * BitPay-style addresses for Bitcoin Cash 269 | * Use new xpub/xprv prefixes for Segwit BIP49 270 | * Add nubits network 271 | 272 | # 0.2.7 273 | 274 | * Add Fujicoin 275 | * List alternative tools 276 | * Remove unused translations and library 277 | 278 | # 0.2.6 279 | 280 | * Detect and warn when entropy is filtered / discarded 281 | * Reword entropy text to indicate using a single source only 282 | * Add BIP49 to More Info section 283 | * Update compile script to work across python 2 and 3 284 | * QR Codes use correctLevel 3 instead of 2 285 | * Source map removed from zxcvbn 286 | * Tidy up code with consistent use of commas and semicolons 287 | 288 | # 0.2.5 289 | 290 | * Rename variables for clarity between BIP49 and P2WPKH Nested In P2SH 291 | * Fix bug for validation of root key when using non-bitcoin networks 292 | * Add option to use P2WPKH Nested In P2SH addresses on BIP32 tab 293 | 294 | # 0.2.4 295 | 296 | * Show error when using xpub with hardened addresses 297 | * Allow switching litecoin prefixes between xprv and Ltpv 298 | 299 | # 0.2.3 300 | 301 | * Add maza coin 302 | 303 | # 0.2.2 304 | 305 | * Improve showing feedback for pending calculations 306 | * Bugfix: Clear old seed when mnemonic is changed 307 | * Add PIVX network 308 | 309 | # 0.2.1 310 | 311 | * BTC is the default coin 312 | * Add myriadcoin 313 | * Add Bitcon Cash 314 | 315 | # 0.2.0 316 | 317 | * BitcoinJS library upgrded to v3.1.1 318 | * Tab order is alphabetical 319 | * BIP44 'purpose' and 'coin' fields are readonly 320 | * Refactor method to clear old data from the display 321 | * BIP49 support 322 | * Release process is documented 323 | 324 | # 0.1.2 325 | 326 | * Add Crown network 327 | * Network names are displayed with currency code 328 | 329 | # 0.1.1 330 | 331 | * Add DASH Testnet 332 | * Change entropy Strength to Time To Crack 333 | 334 | # 0.1.0 2017-06-14 335 | 336 | * Add changelog 337 | * Display version number in top right 338 | * Add hex prefix to ethereum keys 339 | -------------------------------------------------------------------------------- /compile.py: -------------------------------------------------------------------------------- 1 | import os 2 | import re 3 | import datetime 4 | from io import open 5 | 6 | # This script generates the bip39-standalone.html file. 7 | 8 | # It removes script and style tags and replaces with the file content. 9 | 10 | f = open('src/index.html', "r", encoding="utf-8") 11 | page = f.read() 12 | f.close() 13 | 14 | 15 | # Script tags 16 | 17 | scriptsFinder = re.compile("""""") 18 | scripts = scriptsFinder.findall(page) 19 | 20 | for script in scripts: 21 | filename = os.path.join("src", script) 22 | s = open(filename, "r", encoding="utf-8") 23 | scriptContent = "" % s.read() 24 | s.close() 25 | scriptTag = """""" % script 26 | page = page.replace(scriptTag, scriptContent) 27 | 28 | 29 | # Style tags 30 | 31 | stylesFinder = re.compile("""""") 32 | styles = stylesFinder.findall(page) 33 | 34 | for style in styles: 35 | filename = os.path.join("src", style) 36 | s = open(filename, "r", encoding="utf-8") 37 | styleContent = "" % s.read() 38 | s.close() 39 | styleTag = """""" % style 40 | page = page.replace(styleTag, styleContent) 41 | 42 | 43 | # Write the standalone file 44 | 45 | f = open('bip39-standalone.html', 'w', encoding="utf-8") 46 | f.write(page) 47 | f.close() 48 | 49 | print("%s - DONE" % datetime.datetime.now()) 50 | -------------------------------------------------------------------------------- /dev_env_setup.sh: -------------------------------------------------------------------------------- 1 | # this script is intended to be run in a VM 2 | # running ubuntu 20.04 server 3 | # from the root directory of this repo 4 | 5 | echo "This script is intended to be run in a VM." 6 | echo "It may do things to your OS that you don't want to be peristent." 7 | echo "Please type virtualmachine to continue, or Ctrl-C to quit." 8 | 9 | read passage 10 | 11 | if [ "$passage" = "virtualmachine" ]; then 12 | echo "Installing dev environment" 13 | else 14 | echo "Did not type virtualmachine, quitting with no changes applied" 15 | exit 16 | fi 17 | 18 | # set up place for local binaries 19 | mkdir $HOME/.bin 20 | echo "export PATH=$PATH:$HOME/.bin" >> $HOME/.bashrc 21 | source $HOME/.bashrc 22 | 23 | # allow python3 to be run with python command 24 | ln -s /usr/bin/python3 $HOME/.bin/python 25 | 26 | # install firefox and other dependencies 27 | sudo apt-get -y install firefox unzip openjdk-11-jre-headless xvfb libxi6 libgconf-2-4 make build-essential 28 | # install chrome 29 | curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add 30 | sudo sh -c "echo \"deb https://dl.google.com/linux/chrome/deb/ stable main\" >> /etc/apt/sources.list.d/google-chrome.list" 31 | sudo apt-get -y update 32 | sudo apt-get -y install google-chrome-stable 33 | 34 | # install nodejs for running tests 35 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash 36 | # load nvm 37 | source $HOME/.bashrc 38 | export NVM_DIR="$HOME/.nvm" 39 | [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm 40 | [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion 41 | # install latest node 42 | nvm install node 43 | # install jasmine 44 | cd tests 45 | npm install --global jasmine 46 | npm install selenium-webdriver 47 | # install gecko webdriver for firefox 48 | wget https://github.com/mozilla/geckodriver/releases/download/v0.29.0/geckodriver-v0.29.0-linux64.tar.gz --output-document=/tmp/geckodriver.tar.gz 49 | tar -xf /tmp/geckodriver.tar.gz -C $HOME/.bin 50 | # install chrome webdriver for chromium 51 | wget https://chromedriver.storage.googleapis.com/88.0.4324.96/chromedriver_linux64.zip --output-document=/tmp/chromedriver.zip 52 | unzip /tmp/chromedriver.zip -d $HOME/.bin 53 | 54 | # to run tests 55 | # cd tests 56 | # Xvfb :1 -screen 1 1024x768x24 & export DISPLAY=:1.1 57 | # BROWSER=firefox jasmine spec/tests.js 58 | # BROWSER=chrome jasmine spec/tests.js 59 | -------------------------------------------------------------------------------- /libs/base-x/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 base-x contributors 4 | Copyright (c) 2014-2018 The Bitcoin Core developers 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /libs/base-x/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "base-x", 3 | "version": "3.0.7", 4 | "description": "Fast base encoding / decoding of any given alphabet", 5 | "keywords": [ 6 | "base-x", 7 | "base58", 8 | "base62", 9 | "base64", 10 | "crypto", 11 | "crytography", 12 | "decode", 13 | "decoding", 14 | "encode", 15 | "encoding" 16 | ], 17 | "homepage": "https://github.com/cryptocoinjs/base-x", 18 | "bugs": { 19 | "url": "https://github.com/cryptocoinjs/base-x/issues" 20 | }, 21 | "license": "MIT", 22 | "author": "Daniel Cousens", 23 | "files": [ 24 | "src" 25 | ], 26 | "main": "src/index.js", 27 | "types": "src/index.d.ts", 28 | "repository": { 29 | "type": "git", 30 | "url": "https://github.com/cryptocoinjs/base-x.git" 31 | }, 32 | "scripts": { 33 | "build": "tsc -p ./tsconfig.json ; standard --fix; browserify src/index.js --standalone basex > /tmp/base-x.js" 34 | }, 35 | "devDependencies": { 36 | "@types/node": "12.0.10", 37 | "standard": "^10.0.3", 38 | "tape": "^4.5.1", 39 | "typescript": "3.5.2" 40 | }, 41 | "dependencies": { 42 | "safe-buffer": "^5.0.1" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /libs/base-x/readme.md: -------------------------------------------------------------------------------- 1 | Build (will create a bundle and copy it to /tmp/base-x.js): 2 | 3 | npm install 4 | npm run build 5 | -------------------------------------------------------------------------------- /libs/base-x/ts_src/index.ts: -------------------------------------------------------------------------------- 1 | // base-x encoding / decoding 2 | // Copyright (c) 2018 base-x contributors 3 | // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp) 4 | // Distributed under the MIT software license, see the accompanying 5 | // file LICENSE or http://www.opensource.org/licenses/mit-license.php. 6 | 7 | // @ts-ignore 8 | const _Buffer = require('safe-buffer').Buffer; 9 | 10 | function base (ALPHABET: string): base.BaseConverter { 11 | if (ALPHABET.length >= 255) throw new TypeError('Alphabet too long') 12 | 13 | const BASE_MAP = new Uint8Array(256) 14 | BASE_MAP.fill(255) 15 | 16 | for (let i = 0; i < ALPHABET.length; i++) { 17 | const x = ALPHABET.charAt(i) 18 | const xc = x.charCodeAt(0) 19 | 20 | if (BASE_MAP[xc] !== 255) throw new TypeError(x + ' is ambiguous') 21 | BASE_MAP[xc] = i 22 | } 23 | 24 | const BASE = ALPHABET.length 25 | const LEADER = ALPHABET.charAt(0) 26 | const FACTOR = Math.log(BASE) / Math.log(256) // log(BASE) / log(256), rounded up 27 | const iFACTOR = Math.log(256) / Math.log(BASE) // log(256) / log(BASE), rounded up 28 | 29 | function encode (source: Buffer): string { 30 | if (!_Buffer.isBuffer(source)) throw new TypeError('Expected Buffer') 31 | if (source.length === 0) return '' 32 | 33 | // Skip & count leading zeroes. 34 | let zeroes = 0 35 | let length = 0 36 | let pbegin = 0 37 | const pend = source.length 38 | 39 | while (pbegin !== pend && source[pbegin] === 0) { 40 | pbegin++ 41 | zeroes++ 42 | } 43 | 44 | // Allocate enough space in big-endian base58 representation. 45 | const size = ((pend - pbegin) * iFACTOR + 1) >>> 0 46 | const b58 = new Uint8Array(size) 47 | 48 | // Process the bytes. 49 | while (pbegin !== pend) { 50 | let carry = source[pbegin] 51 | 52 | // Apply "b58 = b58 * 256 + ch". 53 | let i = 0 54 | for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) { 55 | carry += (256 * b58[it1]) >>> 0 56 | b58[it1] = (carry % BASE) >>> 0 57 | carry = (carry / BASE) >>> 0 58 | } 59 | 60 | if (carry !== 0) throw new Error('Non-zero carry') 61 | length = i 62 | pbegin++ 63 | } 64 | 65 | // Skip leading zeroes in base58 result. 66 | let it2 = size - length 67 | while (it2 !== size && b58[it2] === 0) { 68 | it2++ 69 | } 70 | 71 | // Translate the result into a string. 72 | let str = LEADER.repeat(zeroes) 73 | for (; it2 < size; ++it2) str += ALPHABET.charAt(b58[it2]) 74 | 75 | return str 76 | } 77 | 78 | function decodeUnsafe (source: string): Buffer | undefined { 79 | if (typeof source !== 'string') throw new TypeError('Expected String') 80 | if (source.length === 0) return _Buffer.alloc(0) 81 | 82 | let psz = 0 83 | 84 | // Skip leading spaces. 85 | if (source[psz] === ' ') return 86 | 87 | // Skip and count leading '1's. 88 | let zeroes = 0 89 | let length = 0 90 | while (source[psz] === LEADER) { 91 | zeroes++ 92 | psz++ 93 | } 94 | 95 | // Allocate enough space in big-endian base256 representation. 96 | const size = (((source.length - psz) * FACTOR) + 1) >>> 0 // log(58) / log(256), rounded up. 97 | const b256 = new Uint8Array(size) 98 | 99 | // Process the characters. 100 | while (source[psz]) { 101 | // Decode character 102 | let carry = BASE_MAP[source.charCodeAt(psz)] 103 | 104 | // Invalid character 105 | if (carry === 255) return 106 | 107 | let i = 0 108 | for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) { 109 | carry += (BASE * b256[it3]) >>> 0 110 | b256[it3] = (carry % 256) >>> 0 111 | carry = (carry / 256) >>> 0 112 | } 113 | 114 | if (carry !== 0) throw new Error('Non-zero carry') 115 | length = i 116 | psz++ 117 | } 118 | 119 | // Skip trailing spaces. 120 | if (source[psz] === ' ') return 121 | 122 | // Skip leading zeroes in b256. 123 | let it4 = size - length 124 | while (it4 !== size && b256[it4] === 0) { 125 | it4++ 126 | } 127 | 128 | const vch = _Buffer.allocUnsafe(zeroes + (size - it4)) 129 | vch.fill(0x00, 0, zeroes) 130 | 131 | let j = zeroes 132 | while (it4 !== size) { 133 | vch[j++] = b256[it4++] 134 | } 135 | 136 | return vch 137 | } 138 | 139 | function decode (string: string): Buffer { 140 | const buffer = decodeUnsafe(string) 141 | if (buffer) return buffer 142 | 143 | throw new Error('Non-base' + BASE + ' character') 144 | } 145 | 146 | return { 147 | encode: encode, 148 | decodeUnsafe: decodeUnsafe, 149 | decode: decode 150 | } 151 | } 152 | 153 | export = base; 154 | 155 | declare namespace base { 156 | interface BaseConverter { 157 | encode(buffer: Buffer): string; 158 | decodeUnsafe(string: string): Buffer | undefined; 159 | decode(string: string): Buffer; 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /libs/base-x/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs", 5 | "outDir": "./src", 6 | "declaration": true, 7 | "rootDir": "./ts_src", 8 | "types": [ 9 | "node" 10 | ], 11 | "allowJs": false, 12 | "strict": true, 13 | "noImplicitAny": true, 14 | "strictNullChecks": true, 15 | "strictFunctionTypes": true, 16 | "strictBindCallApply": true, 17 | "strictPropertyInitialization": true, 18 | "noImplicitThis": true, 19 | "alwaysStrict": true, 20 | "esModuleInterop": false, 21 | "noUnusedLocals": true, 22 | "noUnusedParameters": true 23 | }, 24 | "include": [ 25 | "ts_src/**/*.ts" 26 | ], 27 | "exclude": [ 28 | "**/*.spec.ts", 29 | "node_modules/**/*" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /libs/bitcoinjs-bip38/index.js: -------------------------------------------------------------------------------- 1 | var aes = require('browserify-aes') 2 | var assert = require('assert') 3 | var Buffer = require('safe-buffer').Buffer 4 | var bs58check = require('bs58check') 5 | var createHash = require('create-hash') 6 | var scrypt = require('scryptsy') 7 | var xor = require('buffer-xor/inplace') 8 | 9 | var ecurve = require('ecurve') 10 | var curve = ecurve.getCurveByName('secp256k1') 11 | 12 | var BigInteger = require('bigi') 13 | 14 | // constants 15 | var SCRYPT_PARAMS = { 16 | N: 16384, // specified by BIP38 17 | r: 8, 18 | p: 8 19 | } 20 | var NULL = Buffer.alloc(0) 21 | 22 | function hash160 (buffer) { 23 | var hash 24 | try { 25 | hash = createHash('rmd160') 26 | } catch (e) { 27 | hash = createHash('ripemd160') 28 | } 29 | return hash.update( 30 | createHash('sha256').update(buffer).digest() 31 | ).digest() 32 | } 33 | 34 | function hash256 (buffer) { 35 | return createHash('sha256').update( 36 | createHash('sha256').update(buffer).digest() 37 | ).digest() 38 | } 39 | 40 | function getAddress (d, compressed) { 41 | var Q = curve.G.multiply(d).getEncoded(compressed) 42 | var hash = hash160(Q) 43 | var payload = Buffer.allocUnsafe(21) 44 | payload.writeUInt8(0x00, 0) // XXX TODO FIXME bitcoin only??? damn you BIP38 45 | hash.copy(payload, 1) 46 | 47 | return bs58check.encode(payload) 48 | } 49 | 50 | function encryptRaw (buffer, compressed, passphrase, progressCallback, scryptParams) { 51 | if (buffer.length !== 32) throw new Error('Invalid private key length') 52 | scryptParams = scryptParams || SCRYPT_PARAMS 53 | 54 | var d = BigInteger.fromBuffer(buffer) 55 | var address = getAddress(d, compressed) 56 | var secret = Buffer.from(passphrase, 'utf8') 57 | var salt = hash256(address).slice(0, 4) 58 | 59 | var N = scryptParams.N 60 | var r = scryptParams.r 61 | var p = scryptParams.p 62 | 63 | var scryptBuf = scrypt(secret, salt, N, r, p, 64, progressCallback) 64 | var derivedHalf1 = scryptBuf.slice(0, 32) 65 | var derivedHalf2 = scryptBuf.slice(32, 64) 66 | 67 | var xorBuf = xor(derivedHalf1, buffer) 68 | var cipher = aes.createCipheriv('aes-256-ecb', derivedHalf2, NULL) 69 | cipher.setAutoPadding(false) 70 | cipher.end(xorBuf) 71 | 72 | var cipherText = cipher.read() 73 | 74 | // 0x01 | 0x42 | flagByte | salt (4) | cipherText (32) 75 | var result = Buffer.allocUnsafe(7 + 32) 76 | result.writeUInt8(0x01, 0) 77 | result.writeUInt8(0x42, 1) 78 | result.writeUInt8(compressed ? 0xe0 : 0xc0, 2) 79 | salt.copy(result, 3) 80 | cipherText.copy(result, 7) 81 | 82 | return result 83 | } 84 | 85 | function encrypt (buffer, compressed, passphrase, progressCallback, scryptParams) { 86 | return bs58check.encode(encryptRaw(buffer, compressed, passphrase, progressCallback, scryptParams)) 87 | } 88 | 89 | // some of the techniques borrowed from: https://github.com/pointbiz/bitaddress.org 90 | function decryptRaw (buffer, passphrase, progressCallback, scryptParams) { 91 | // 39 bytes: 2 bytes prefix, 37 bytes payload 92 | if (buffer.length !== 39) throw new Error('Invalid BIP38 data length') 93 | if (buffer.readUInt8(0) !== 0x01) throw new Error('Invalid BIP38 prefix') 94 | scryptParams = scryptParams || SCRYPT_PARAMS 95 | 96 | // check if BIP38 EC multiply 97 | var type = buffer.readUInt8(1) 98 | if (type === 0x43) return decryptECMult(buffer, passphrase, progressCallback, scryptParams) 99 | if (type !== 0x42) throw new Error('Invalid BIP38 type') 100 | 101 | passphrase = Buffer.from(passphrase, 'utf8') 102 | 103 | var flagByte = buffer.readUInt8(2) 104 | var compressed = flagByte === 0xe0 105 | if (!compressed && flagByte !== 0xc0) throw new Error('Invalid BIP38 compression flag') 106 | 107 | var N = scryptParams.N 108 | var r = scryptParams.r 109 | var p = scryptParams.p 110 | 111 | var salt = buffer.slice(3, 7) 112 | var scryptBuf = scrypt(passphrase, salt, N, r, p, 64, progressCallback) 113 | var derivedHalf1 = scryptBuf.slice(0, 32) 114 | var derivedHalf2 = scryptBuf.slice(32, 64) 115 | 116 | var privKeyBuf = buffer.slice(7, 7 + 32) 117 | var decipher = aes.createDecipheriv('aes-256-ecb', derivedHalf2, NULL) 118 | decipher.setAutoPadding(false) 119 | decipher.end(privKeyBuf) 120 | 121 | var plainText = decipher.read() 122 | var privateKey = xor(derivedHalf1, plainText) 123 | 124 | // verify salt matches address 125 | var d = BigInteger.fromBuffer(privateKey) 126 | var address = getAddress(d, compressed) 127 | var checksum = hash256(address).slice(0, 4) 128 | assert.deepStrictEqual(salt, checksum) 129 | 130 | return { 131 | privateKey: privateKey, 132 | compressed: compressed 133 | } 134 | } 135 | 136 | function decrypt (string, passphrase, progressCallback, scryptParams) { 137 | return decryptRaw(bs58check.decode(string), passphrase, progressCallback, scryptParams) 138 | } 139 | 140 | function decryptECMult (buffer, passphrase, progressCallback, scryptParams) { 141 | passphrase = Buffer.from(passphrase, 'utf8') 142 | buffer = buffer.slice(1) // FIXME: we can avoid this 143 | scryptParams = scryptParams || SCRYPT_PARAMS 144 | 145 | var flag = buffer.readUInt8(1) 146 | var compressed = (flag & 0x20) !== 0 147 | var hasLotSeq = (flag & 0x04) !== 0 148 | 149 | assert.strictEqual((flag & 0x24), flag, 'Invalid private key.') 150 | 151 | var addressHash = buffer.slice(2, 6) 152 | var ownerEntropy = buffer.slice(6, 14) 153 | var ownerSalt 154 | 155 | // 4 bytes ownerSalt if 4 bytes lot/sequence 156 | if (hasLotSeq) { 157 | ownerSalt = ownerEntropy.slice(0, 4) 158 | 159 | // else, 8 bytes ownerSalt 160 | } else { 161 | ownerSalt = ownerEntropy 162 | } 163 | 164 | var encryptedPart1 = buffer.slice(14, 22) // First 8 bytes 165 | var encryptedPart2 = buffer.slice(22, 38) // 16 bytes 166 | 167 | var N = scryptParams.N 168 | var r = scryptParams.r 169 | var p = scryptParams.p 170 | var preFactor = scrypt(passphrase, ownerSalt, N, r, p, 32, progressCallback) 171 | 172 | var passFactor 173 | if (hasLotSeq) { 174 | var hashTarget = Buffer.concat([preFactor, ownerEntropy]) 175 | passFactor = hash256(hashTarget) 176 | } else { 177 | passFactor = preFactor 178 | } 179 | 180 | var passInt = BigInteger.fromBuffer(passFactor) 181 | var passPoint = curve.G.multiply(passInt).getEncoded(true) 182 | 183 | var seedBPass = scrypt(passPoint, Buffer.concat([addressHash, ownerEntropy]), 1024, 1, 1, 64) 184 | var derivedHalf1 = seedBPass.slice(0, 32) 185 | var derivedHalf2 = seedBPass.slice(32, 64) 186 | 187 | var decipher = aes.createDecipheriv('aes-256-ecb', derivedHalf2, Buffer.alloc(0)) 188 | decipher.setAutoPadding(false) 189 | decipher.end(encryptedPart2) 190 | 191 | var decryptedPart2 = decipher.read() 192 | var tmp = xor(decryptedPart2, derivedHalf1.slice(16, 32)) 193 | var seedBPart2 = tmp.slice(8, 16) 194 | 195 | var decipher2 = aes.createDecipheriv('aes-256-ecb', derivedHalf2, Buffer.alloc(0)) 196 | decipher2.setAutoPadding(false) 197 | decipher2.write(encryptedPart1) // first 8 bytes 198 | decipher2.end(tmp.slice(0, 8)) // last 8 bytes 199 | 200 | var seedBPart1 = xor(decipher2.read(), derivedHalf1.slice(0, 16)) 201 | var seedB = Buffer.concat([seedBPart1, seedBPart2], 24) 202 | var factorB = BigInteger.fromBuffer(hash256(seedB)) 203 | 204 | // d = passFactor * factorB (mod n) 205 | var d = passInt.multiply(factorB).mod(curve.n) 206 | 207 | return { 208 | privateKey: d.toBuffer(32), 209 | compressed: compressed 210 | } 211 | } 212 | 213 | function verify (string) { 214 | var decoded = bs58check.decodeUnsafe(string) 215 | if (!decoded) return false 216 | 217 | if (decoded.length !== 39) return false 218 | if (decoded.readUInt8(0) !== 0x01) return false 219 | 220 | var type = decoded.readUInt8(1) 221 | var flag = decoded.readUInt8(2) 222 | 223 | // encrypted WIF 224 | if (type === 0x42) { 225 | if (flag !== 0xc0 && flag !== 0xe0) return false 226 | 227 | // EC mult 228 | } else if (type === 0x43) { 229 | if ((flag & ~0x24)) return false 230 | } else { 231 | return false 232 | } 233 | 234 | return true 235 | } 236 | 237 | module.exports = { 238 | decrypt: decrypt, 239 | decryptECMult: decryptECMult, 240 | decryptRaw: decryptRaw, 241 | encrypt: encrypt, 242 | encryptRaw: encryptRaw, 243 | verify: verify 244 | } 245 | -------------------------------------------------------------------------------- /libs/bitcoinjs-bip38/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bip38", 3 | "version": "2.0.2", 4 | "description": "BIP38 is a standard process to encrypt Bitcoin and crypto currency private keys that is impervious to brute force attacks thus protecting the user.", 5 | "main": "index.js", 6 | "keywords": [ 7 | "bitcoin", 8 | "crypto", 9 | "cryptography", 10 | "litecoin" 11 | ], 12 | "homepage": "http://cryptocoinjs.com/modules/currency/bip38/", 13 | "author": "JP Richardson", 14 | "dependencies": { 15 | "bigi": "^1.2.0", 16 | "browserify-aes": "^1.0.1", 17 | "bs58check": "<3.0.0", 18 | "buffer-xor": "^1.0.2", 19 | "create-hash": "^1.1.1", 20 | "ecurve": "^1.0.0", 21 | "scryptsy": "^2.0.0" 22 | }, 23 | "devDependencies": { 24 | }, 25 | "repository": { 26 | "url": "git@github.com:bitcoinjs/bip38.git", 27 | "type": "git" 28 | }, 29 | "scripts": { 30 | "browser-test": "mochify --wd -R spec --timeout 100000", 31 | "build": "browserify index.js --standalone bitcoinjs-bip38 > /tmp/bitcoinjs-bip38.js", 32 | "coverage": "istanbul cover _mocha -- --reporter list test/*.js", 33 | "coveralls": "npm run-script coverage && coveralls < coverage/lcov.info", 34 | "standard": "standard", 35 | "test": "npm run standard && npm run unit", 36 | "unit": "mocha --ui bdd --timeout 240000" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /libs/bitcoinjs-bip38/readme.md: -------------------------------------------------------------------------------- 1 | Build (will create a bundle and copy it to /tmp/bitcoinjs-bip38.js): 2 | 3 | npm install 4 | npm run build 5 | -------------------------------------------------------------------------------- /libs/bitcoinjs-lib/bitcoinjs-lib.js: -------------------------------------------------------------------------------- 1 | let bitcoin = require('bitcoinjs-lib') 2 | 3 | module.exports = { 4 | bitcoin 5 | } 6 | -------------------------------------------------------------------------------- /libs/bitcoinjs-lib/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bitcoinjs-lib", 3 | "version": "3.3.2", 4 | "scripts": { 5 | "build": "browserify bitcoinjs-lib.js --standalone bitcoinjs > /tmp/bitcoinjs-lib.js" 6 | }, 7 | "dependencies": { 8 | "bitcoinjs-lib": "3.3.2" 9 | }, 10 | "devDependencies": { 11 | "browserify": "^16.2.3", 12 | "uglify-es": "^3.3.9" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /libs/bitcoinjs-lib/readme.md: -------------------------------------------------------------------------------- 1 | Build (will create a bundle and copy it to /tmp/bitcoinjs-lib.js): 2 | 3 | npm install 4 | npm run build 5 | manually add changes in https://github.com/iancoleman/bip39/commit/0702ecd3520c44cb8016f80329dcb5a3c8df88fc 6 | -------------------------------------------------------------------------------- /libs/combined/index.js: -------------------------------------------------------------------------------- 1 | /* base-x */ 2 | 3 | module.exports.basex = require('base-x') 4 | 5 | /* base32 */ 6 | 7 | module.exports.base32 = require('base32.js') 8 | 9 | /* bchaddrjs */ 10 | 11 | module.exports.bchaddr = require('bchaddrjs') 12 | 13 | /* bchaddrjs slp */ 14 | 15 | module.exports.bchaddrSlp = require('bchaddrjs-slp') 16 | 17 | /* bech32 */ 18 | 19 | module.exports.bech32 = require('bech32') 20 | 21 | /* biginteger */ 22 | 23 | module.exports.BigInteger = require('javascript-biginteger') 24 | 25 | /* bitcoinjs-bip38 */ 26 | 27 | module.exports.bip38 = require('bip38') 28 | 29 | /* bip85 */ 30 | 31 | module.exports.bip85 = require('bip85') 32 | 33 | /* bitcoinjs-lib */ 34 | 35 | module.exports.bitcoin = require('bitcoinjs-lib') 36 | 37 | /* buffer */ 38 | 39 | module.exports.buffer = require('buffer'); 40 | 41 | /* elastos */ 42 | // See https://github.com/iancoleman/bip39/pull/368 43 | // and https://github.com/johnnynanjiang/Elastos.SDK.Keypair.Javascript/tree/iancoleman-bip39 44 | 45 | module.exports.elastosjs = require('elastos-wallet-js') 46 | 47 | /* ethereum-util */ 48 | 49 | module.exports.ethUtil = require('ethereumjs-util') 50 | 51 | /* fast-levenshtein */ 52 | 53 | module.exports.levenshtein = require('fast-levenshtein') 54 | 55 | /* groestlcoin */ 56 | 57 | module.exports.groestlcoinjs = require('groestlcoinjs-lib') 58 | 59 | /* groestlcoin bip38 */ 60 | 61 | module.exports.groestlcoinjsBip38 = require('bip38grs') 62 | 63 | /* kjua qr codes */ 64 | 65 | module.exports.kjua = require('kjua') 66 | 67 | /* nebulas */ 68 | 69 | try { 70 | module.exports.nebulas = require('nebulas') 71 | } 72 | catch (e) { 73 | console.warn("Error loading nebulas library"); 74 | console.warn(e); 75 | }; 76 | 77 | /* stellar-util */ 78 | 79 | let StellarBase = require('stellar-base'); 80 | let edHd = require('ed25519-hd-key'); 81 | module.exports.stellarUtil = { 82 | getKeypair: function (path, seed) { 83 | const result = edHd.derivePath(path, seed); 84 | return StellarBase.Keypair.fromRawEd25519Seed(result.key); 85 | }, 86 | dummyNetwork: { 87 | bip32: {public: 0, private: 0}, 88 | messagePrefix: '', 89 | pubKeyHash: 0, 90 | scriptHash: 0, 91 | wif: 0, 92 | }, 93 | } 94 | 95 | /* zoobc-util */ 96 | 97 | let base32 = require('base32.js'); 98 | let nbl = require('nebulas'); 99 | module.exports.zoobcUtil = { 100 | getKeypair: function (path, seed) { 101 | const { key, chainCode} = edHd.derivePath(path, seed); 102 | const pubKey = edHd.getPublicKey(key); 103 | return {key,chainCode, pubKey}; 104 | }, 105 | getZBCAddress(publicKey, prefix = "ZBC") { 106 | const prefixDefault = ["ZBC", "ZNK", "ZBL", "ZTX"]; 107 | const valid = prefixDefault.indexOf(prefix) > -1; 108 | if (valid) { 109 | var bytes = new Uint8Array(35); 110 | for (let i = 0; i < 32; i++) bytes[i] = publicKey[i]; 111 | for (let i = 0; i < 3; i++) bytes[i + 32] = prefix.charCodeAt(i); 112 | const checksum = nbl.CryptoUtils.sha3(bytes); 113 | for (let i = 0; i < 3; i++) bytes[i + 32] = Number(checksum[i]); 114 | var segs = [prefix]; 115 | var b32 = base32.encode(bytes); 116 | for (let i = 0; i < 7; i++) segs.push(b32.substr(i * 8, 8)); 117 | return segs.join("_"); 118 | } else { 119 | throw new Error("The Prefix not available!"); 120 | } 121 | } 122 | } 123 | 124 | /* nano-util */ 125 | 126 | let NanoBase = require('nanocurrency-web'); 127 | module.exports.nanoUtil = { 128 | getKeypair: function (index, seed) { 129 | const accounts = NanoBase.wallet.accounts(seed, index, index) 130 | return {privKey: accounts[0].privateKey, pubKey: accounts[0].publicKey, address: accounts[0].address}; 131 | }, 132 | dummyNetwork: { 133 | bip32: {public: 0, private: 0}, 134 | messagePrefix: '', 135 | pubKeyHash: 0, 136 | scriptHash: 0, 137 | wif: 0, 138 | }, 139 | } 140 | 141 | /* unorm */ 142 | 143 | module.exports.unorm = require('unorm') 144 | 145 | /* zxcvbn */ 146 | 147 | module.exports.zxcvbn = require('zxcvbn') 148 | 149 | /* handshake */ 150 | module.exports.handshake = require('handshake-util') 151 | 152 | /* bs58 */ 153 | try { 154 | module.exports.bs58 = require('bs58') 155 | } 156 | catch (e) { 157 | console.warn("Error loading bs58 library"); 158 | console.warn(e); 159 | }; 160 | 161 | /* create-hash */ 162 | try { 163 | module.exports.createHash = require('create-hash') 164 | } 165 | catch (e) { 166 | console.warn("Error loading create-hash library"); 167 | console.warn(e); 168 | }; 169 | 170 | -------------------------------------------------------------------------------- /libs/combined/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bip39-tool-external-libs", 3 | "version": "0.4.0", 4 | "scripts": { 5 | "build": "browserify index.js --standalone libs | uglifyjs -c > ../../src/js/bip39-libs.js" 6 | }, 7 | "dependencies": { 8 | "base-x": "3.0.7", 9 | "bchaddrjs": "0.4.4", 10 | "bchaddrjs-slp": "git://github.com/simpleledger/bchaddrjs.git#af16e44a6bfbe4b3980a62dba50e2f68ed864c6b", 11 | "bech32": "1.1.4", 12 | "bip38": "2.0.2", 13 | "bip38grs": "git://github.com/Groestlcoin/bip38grs.git#091975b01679b74dc0a4136bb743fe17791b0151", 14 | "bip85": "0.0.3", 15 | "bitcoinjs-lib": "git://github.com/iancoleman/bitcoinjs-lib.git#v3.3.2_16bit", 16 | "bs58": "^4.0.1", 17 | "buffer": "^5.4.3", 18 | "create-hash": "^1.2.0", 19 | "ed25519-hd-key": "^1.0.0", 20 | "elastos-wallet-js": "git://github.com/johnnynanjiang/Elastos.SDK.Keypair.Javascript.git#491dc51b64efaf0a8aae62028b68e2c8e38fde06", 21 | "ethereumjs-util": "6.0.0", 22 | "fast-levenshtein": "2.0.6", 23 | "groestlcoinjs-lib": "git://github.com/Groestlcoin/groestlcoinjs-lib.git#3.3.2", 24 | "handshake-util": "1.2.0", 25 | "javascript-biginteger": "0.9.2", 26 | "jsrsasign": "^8.0.19", 27 | "kjua": "0.6.0", 28 | "nanocurrency-web": "^1.2.2", 29 | "nebulas": "0.5.6", 30 | "stellar-base": "^0.10.0", 31 | "unorm": "1.6.0", 32 | "zxcvbn": "4.4.2" 33 | }, 34 | "devDependencies": { 35 | "browserify": "^16.2.3", 36 | "uglify-es": "^3.3.9" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /libs/combined/readme.md: -------------------------------------------------------------------------------- 1 | # Generate libs 2 | 3 | ``` 4 | npm install --no-optional 5 | npm run build 6 | ``` 7 | -------------------------------------------------------------------------------- /libs/ethereumjs-util/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ethereumjs-util", 3 | "version": "6.0.0", 4 | "description": "a collection of utility functions for Ethereum", 5 | "main": "dist/index.js", 6 | "files": [ 7 | "dist" 8 | ], 9 | "scripts": { 10 | "build": "browserify index.js -s ethUtil -o /tmp/ethereumjs-util.js", 11 | "coverage": "npm run build:dist && istanbul cover _mocha", 12 | "coveralls": "npm run coverage && coveralls ./docs/index.md" 20 | }, 21 | "repository": { 22 | "type": "git", 23 | "url": "https://github.com/ethereumjs/ethereumjs-util.git" 24 | }, 25 | "keywords": [ 26 | "ethereum", 27 | "utilties" 28 | ], 29 | "author": "mjbecze ", 30 | "contributors": [ 31 | { 32 | "name": "Tim Coulter", 33 | "email": "tim@timothyjcoulter.com", 34 | "url": "https://github.com/tcoulter", 35 | "contributions": 1, 36 | "additions": 2, 37 | "deletions": 2 38 | }, 39 | { 40 | "name": "Nick Dodson", 41 | "url": "https://github.com/SilentCicero", 42 | "contributions": 2, 43 | "additions": 26, 44 | "deletions": 2 45 | }, 46 | { 47 | "name": "Mr. Chico", 48 | "url": "https://github.com/MrChico", 49 | "contributions": 1, 50 | "additions": 11, 51 | "deletions": 1 52 | }, 53 | { 54 | "name": "Dũng Trần", 55 | "email": "tad88.dev@gmail.com", 56 | "url": "https://github.com/tad88dev", 57 | "contributions": 2, 58 | "additions": 5, 59 | "deletions": 5 60 | }, 61 | { 62 | "name": "Alex Beregszaszi", 63 | "email": "alex@rtfs.hu", 64 | "url": "https://github.com/axic", 65 | "contributions": 77, 66 | "additions": 1796, 67 | "deletions": 642 68 | }, 69 | { 70 | "name": "Taylor Gerring", 71 | "url": "https://github.com/tgerring", 72 | "contributions": 1, 73 | "additions": 1, 74 | "deletions": 1 75 | }, 76 | { 77 | "name": "Kirill Fomichev", 78 | "email": "fanatid@ya.ru", 79 | "url": "https://github.com/fanatid", 80 | "contributions": 8, 81 | "additions": 32, 82 | "deletions": 16 83 | }, 84 | { 85 | "name": "kumavis", 86 | "email": "aaron@kumavis.me", 87 | "url": "https://github.com/kumavis", 88 | "contributions": 2, 89 | "additions": 2, 90 | "deletions": 2 91 | }, 92 | { 93 | "name": "Alexander Sinyagin", 94 | "email": "sinyagin.alexander@gmail.com", 95 | "url": "https://github.com/asinyagin", 96 | "contributions": 1, 97 | "additions": 3, 98 | "deletions": 1 99 | } 100 | ], 101 | "license": "MPL-2.0", 102 | "bugs": { 103 | "url": "https://github.com/ethereumjs/ethereumjs-util/issues" 104 | }, 105 | "homepage": "https://github.com/ethereumjs/ethereumjs-util", 106 | "dependencies": { 107 | "bn.js": "^4.11.0", 108 | "create-hash": "^1.1.2", 109 | "ethjs-util": "^0.1.6", 110 | "keccak": "^1.0.2", 111 | "rlp": "^2.0.0", 112 | "safe-buffer": "^5.1.1", 113 | "secp256k1": "^3.0.1" 114 | }, 115 | "devDependencies": {}, 116 | "standard": { 117 | "globals": [ 118 | "describe", 119 | "it" 120 | ], 121 | "ignore": [ 122 | "dist/**" 123 | ] 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /libs/ethereumjs-util/readme.md: -------------------------------------------------------------------------------- 1 | Build (will create a bundle and copy it to /tmp/ethereumjs-util.js): 2 | 3 | npm install 4 | npm run build 5 | -------------------------------------------------------------------------------- /libs/nanocurrency-web/nano-util.js: -------------------------------------------------------------------------------- 1 | const NanoBase = require('nanocurrency-web'); 2 | 3 | window.nanoUtil = { 4 | getKeypair: function (index, seed) { 5 | const accounts = NanoBase.wallet.accounts(seed, index, index) 6 | return {privKey: accounts[0].privateKey, pubKey: accounts[0].publicKey, address: accounts[0].address}; 7 | }, 8 | dummyNetwork: { 9 | bip32: {public: 0, private: 0}, 10 | messagePrefix: '', 11 | pubKeyHash: 0, 12 | scriptHash: 0, 13 | wif: 0, 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /libs/nanocurrency-web/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nano-util", 3 | "version": "0.0.1", 4 | "scripts": { 5 | "build": "browserify nano-util.js > /tmp/nano-util.js" 6 | }, 7 | "dependencies": { 8 | "nanocurrency-web": "^1.2.2" 9 | }, 10 | "devDependencies": { 11 | "browserify": "^16.2.3", 12 | "uglify-es": "^3.3.9" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /libs/nanocurrency-web/readme.md: -------------------------------------------------------------------------------- 1 | Build (will create a bundle and copy it to /tmp/nano-util.js): 2 | 3 | npm install 4 | npm run build 5 | -------------------------------------------------------------------------------- /libs/stellar-util/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "stellar-util", 3 | "version": "0.0.1", 4 | "scripts": { 5 | "build": "browserify stellar-util.js > /tmp/stellar-util.js" 6 | }, 7 | "dependencies": { 8 | "ed25519-hd-key": "^1.0.0", 9 | "stellar-base": "^0.10.0" 10 | }, 11 | "devDependencies": { 12 | "browserify": "^16.2.3", 13 | "uglify-es": "^3.3.9" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /libs/stellar-util/readme.md: -------------------------------------------------------------------------------- 1 | Build (will create a bundle and copy it to /tmp/stellar-util.js): 2 | 3 | npm install 4 | npm run build 5 | -------------------------------------------------------------------------------- /libs/stellar-util/stellar-util.js: -------------------------------------------------------------------------------- 1 | const StellarBase = require('stellar-base'); 2 | const edHd = require('ed25519-hd-key'); 3 | 4 | window.stellarUtil = { 5 | getKeypair: function (path, seed) { 6 | const result = edHd.derivePath(path, seed); 7 | return StellarBase.Keypair.fromRawEd25519Seed(result.key); 8 | }, 9 | dummyNetwork: { 10 | bip32: {public: 0, private: 0}, 11 | messagePrefix: '', 12 | pubKeyHash: 0, 13 | scriptHash: 0, 14 | wif: 0, 15 | }, 16 | } 17 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # BIP39 Tool 2 | 3 | A tool for converting BIP39 mnemonic phrases to addresses and private keys. 4 | 5 | ## Online Version 6 | 7 | https://iancoleman.io/bip39/ 8 | 9 | ## Standalone offline version 10 | 11 | Download `bip39-standalone.html` from 12 | [the releases](https://github.com/iancoleman/bip39/releases). 13 | 14 | Open the file in a browser by double clicking it. 15 | 16 | This can be compiled from source using the command `python compile.py` 17 | 18 | ## Usage 19 | 20 | Enter your BIP39 phrase into the 'BIP39 Phrase' field, or press 21 | 'Generate Random Phrase' 22 | 23 | If required, set the derivation path, although the defaults are quite usable. 24 | 25 | See the table for a list of addresses generated from the phrase. 26 | 27 | Toggle columns to blank to easily copy/paste a single column of data, eg to 28 | import private keys into a wallet or supply someone with a list of addresses. 29 | 30 | The BIP32 keys can be used at [bip32.org](https://bip32.org) if desired. 31 | 32 | ## Donations 33 | 34 | Since this project is the efforts of many people, most of which don't appear in 35 | the obvious places like code or issues, donating to the project itself causes 36 | significant operational difficulties. 37 | 38 | As a result, if you would like to support this project financially you are 39 | encouraged to donate to one of the many groups that makes the internet a place 40 | amenable to projects such as this one. 41 | 42 | [Donation-accepting organizations and projects](https://en.bitcoin.it/wiki/Donation-accepting_organizations_and_projects) 43 | 44 | If the list is too difficult to choose from, the EFF is a good choice. 45 | 46 | [Electronic Frontier Foundation](https://supporters.eff.org/donate) 47 | 48 | or for a direct bitcoin address, consider donating to the 49 | [Free Software Foundation](https://www.fsf.org/about/ways-to-donate/) 50 | at 1PC9aZC4hNX2rmmrt7uHTfYAS3hRbph4UN 51 | 52 | ![alt text](https://static.fsf.org/nosvn/images/bitcoin_qrcodes/fsf.png "FSF Bitcoin Address") 53 | 54 | ## Making changes 55 | 56 | Please do not make modifications to `bip39-standalone.html`, since they will 57 | be overwritten by `compile.py`. 58 | 59 | Make changes in `src/*`. 60 | 61 | Changes are applied during release using the command `python compile.py`, so 62 | please do not commit changes to `bip39-standalone.html` 63 | 64 | # Tests 65 | 66 | Tests depend on 67 | 68 | * nodejs 69 | * selenium webdriver - cd /path/to/bip39/tests; npm install 70 | * selenium driver for firefox ([geckodriver](https://github.com/mozilla/geckodriver/releases)) and / or chrome ([chromedriver](https://sites.google.com/a/chromium.org/chromedriver/downloads)) 71 | * jasmine - npm install --global jasmine 72 | 73 | Before running tests, the site must be served at http://localhost:8000. 74 | 75 | ``` 76 | $ cd /path/to/bip39/src 77 | $ python -m http.server 78 | 79 | or for python2 80 | $ python -m SimpleHTTPServer 81 | ``` 82 | 83 | Run tests from the command-line 84 | 85 | ``` 86 | $ cd /path/to/bip39/tests 87 | $ jasmine spec/tests.js 88 | ``` 89 | 90 | # License 91 | 92 | This BIP39 tool is released under the terms of the MIT license. See LICENSE for 93 | more information or see https://opensource.org/licenses/MIT. 94 | -------------------------------------------------------------------------------- /release_process.md: -------------------------------------------------------------------------------- 1 | Once all code changes for this version have been committed, a release can be 2 | created with the following steps: 3 | 4 | 1. Run tests and ensure all tests pass 5 | 1. Set the version in index.html 6 | 1. Update changelog 7 | 1. Run `python compile.py` 8 | 1. Commit these changes with message `Release vX.Y.Z` 9 | 1. Tag the commit `git tag X.Y.Z` 10 | 1. Get the hash of the file `sha256sum bip39-standalone.html` 11 | 1. Create the text for the release notes (see prior releases) 12 | 1. Sign the release notes `gpg --clearsign /tmp/signature.txt` 13 | 1. Push the changes `git push` 14 | 1. Push the new tag `git push --tags` 15 | 1. Create a release on github from the tagged commit 16 | 1. include the signed release notes as text for the release 17 | 1. include the changelog for this release as text for the release 18 | 1. attach signature.txt.asc 19 | 1. attach the bip39-standalone.html file 20 | 1. Download the file from the release and confirm it hashes to the expected value `sha256sum bip39-standalone.html` 21 | 1. Download the signature from the release and verify it. `gpg --verify signature.txt.asc` 22 | 1. Publish to any hosted locations (eg iancoleman.github.io/bip39) 23 | 1. Add a new post to twitter from @bip39tool with the version, link and hash 24 | -------------------------------------------------------------------------------- /src/css/app.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-bottom: 32px; 3 | } 4 | .form-control[readonly] { 5 | cursor: text; 6 | } 7 | .feedback-container { 8 | position: fixed; 9 | top: 0; 10 | width: 100%; 11 | text-align: center; 12 | z-index: 4; 13 | } 14 | .feedback { 15 | display: table; 16 | padding: 0.5em 1em; 17 | background-color: orange; 18 | margin: 0 auto; 19 | font-size: 2em; 20 | color: #444; 21 | border: 2px solid #555; 22 | border-top: 0; 23 | border-bottom-left-radius: 20px 20px; 24 | border-bottom-right-radius: 20px 20px; 25 | } 26 | .no-border { 27 | border: 0; 28 | box-shadow: inset 0 1px 1px rgba(0,0,0,.0); 29 | -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.0); 30 | } 31 | .phrase { 32 | word-break: keep-all; 33 | } 34 | .generate-container .strength { 35 | /* override mobile width from bootstrap */ 36 | width: auto!important; 37 | display: inline-block; 38 | } 39 | .languages a { 40 | padding-left: 10px; 41 | } 42 | .languages a:nth-of-type(1) { 43 | margin-left: -12px; 44 | padding-left: 0; 45 | } 46 | .monospace { 47 | font-family: monospace; 48 | } 49 | .entropy-container .filtered, 50 | .entropy-container .binary { 51 | word-wrap: break-word; 52 | } 53 | .entropy-container li { 54 | padding-bottom: 5px; 55 | } 56 | .card-suit { 57 | font-size: 19px; 58 | line-height: 0; 59 | } 60 | .card-suit.club { 61 | color: #009F00; 62 | } 63 | .card-suit.diamond { 64 | color: #3D5DC4; 65 | } 66 | .card-suit.heart { 67 | color: #F00; 68 | } 69 | .card-suit.spade { 70 | color: #000; 71 | } 72 | .qr-container { 73 | position: fixed; 74 | top: 0; 75 | right: 0; 76 | text-align: center; 77 | background-color: #FFF; 78 | border: 1px solid #CCC; 79 | } 80 | .qr-image { 81 | margin: 5px; 82 | } 83 | .qr-hint, 84 | .qr-warning { 85 | padding: 2px; 86 | max-width: 320px; 87 | } 88 | .more-info { 89 | cursor: help; 90 | border-bottom: 1px dashed #000; 91 | text-decoration: none; 92 | } 93 | .version { 94 | position: absolute; 95 | top: 5px; 96 | right: 5px; 97 | } 98 | .csv { 99 | margin-top: 20px; 100 | margin-bottom: 20px; 101 | white-space: pre; 102 | overflow-wrap: normal; 103 | overflow-x: scroll; 104 | font-family: monospace; 105 | } 106 | .visual-privacy .private-data { 107 | display: none; 108 | } 109 | .text-weight-normal { 110 | font-weight: normal !important; 111 | } 112 | -------------------------------------------------------------------------------- /src/js/casinocoin-util.js: -------------------------------------------------------------------------------- 1 | function convertCasinoCoinAdrr(address) { 2 | return libs.basex('cpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2brdeCg65jkm8oFqi1tuvAxyz').encode( 3 | libs.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(address) 4 | ) 5 | } 6 | 7 | function convertCasinoCoinPriv(priv) { 8 | return libs.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(priv).toString("hex").slice(2,66) 9 | } 10 | -------------------------------------------------------------------------------- /src/js/cosmos-util.js: -------------------------------------------------------------------------------- 1 | function CosmosBufferToPublic(pubBuf, hrp = "cosmos") { 2 | const Buffer = libs.buffer.Buffer; 3 | const AminoSecp256k1PubkeyPrefix = Buffer.from("EB5AE987", "hex"); 4 | const AminoSecp256k1PubkeyLength = Buffer.from("21", "hex"); 5 | pubBuf = Buffer.concat([AminoSecp256k1PubkeyPrefix, AminoSecp256k1PubkeyLength, pubBuf]); 6 | return libs.bech32.encode(`${hrp}pub`, libs.bech32.toWords(pubBuf)); 7 | } 8 | 9 | function CosmosBufferToAddress(pubBuf, hrp = "cosmos") { 10 | const sha256_ed = libs.createHash("sha256").update(pubBuf).digest(); 11 | const ripemd160_ed = libs.createHash("rmd160").update(sha256_ed).digest(); 12 | return libs.bech32.encode(hrp, libs.bech32.toWords(ripemd160_ed)); 13 | } 14 | -------------------------------------------------------------------------------- /src/js/entropy.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Detects entropy from a string. 3 | * 4 | * Formats include: 5 | * binary [0-1] 6 | * base 6 [0-5] 7 | * dice 6 [1-6] 8 | * decimal [0-9] 9 | * hexadecimal [0-9A-F] 10 | * card [A2-9TJQK][CDHS] 11 | * 12 | * Automatically uses lowest entropy to avoid issues such as interpretting 0101 13 | * as hexadecimal which would be 16 bits when really it's only 4 bits of binary 14 | * entropy. 15 | */ 16 | 17 | window.Entropy = new (function() { 18 | 19 | let eventBits = { 20 | 21 | "binary": { 22 | "0": "0", 23 | "1": "1", 24 | }, 25 | 26 | // log2(6) = 2.58496 bits per roll, with bias 27 | // 4 rolls give 2 bits each 28 | // 2 rolls give 1 bit each 29 | // Average (4*2 + 2*1) / 6 = 1.66 bits per roll without bias 30 | "base 6": { 31 | "0": "00", 32 | "1": "01", 33 | "2": "10", 34 | "3": "11", 35 | "4": "0", 36 | "5": "1", 37 | }, 38 | 39 | // log2(6) = 2.58496 bits per roll, with bias 40 | // 4 rolls give 2 bits each 41 | // 2 rolls give 1 bit each 42 | // Average (4*2 + 2*1) / 6 = 1.66 bits per roll without bias 43 | "base 6 (dice)": { 44 | "0": "00", // equivalent to 0 in base 6 45 | "1": "01", 46 | "2": "10", 47 | "3": "11", 48 | "4": "0", 49 | "5": "1", 50 | }, 51 | 52 | // log2(10) = 3.321928 bits per digit, with bias 53 | // 8 digits give 3 bits each 54 | // 2 digits give 1 bit each 55 | // Average (8*3 + 2*1) / 10 = 2.6 bits per digit without bias 56 | "base 10": { 57 | "0": "000", 58 | "1": "001", 59 | "2": "010", 60 | "3": "011", 61 | "4": "100", 62 | "5": "101", 63 | "6": "110", 64 | "7": "111", 65 | "8": "0", 66 | "9": "1", 67 | }, 68 | 69 | "hexadecimal": { 70 | "0": "0000", 71 | "1": "0001", 72 | "2": "0010", 73 | "3": "0011", 74 | "4": "0100", 75 | "5": "0101", 76 | "6": "0110", 77 | "7": "0111", 78 | "8": "1000", 79 | "9": "1001", 80 | "a": "1010", 81 | "b": "1011", 82 | "c": "1100", 83 | "d": "1101", 84 | "e": "1110", 85 | "f": "1111", 86 | }, 87 | 88 | // log2(52) = 5.7004 bits per card, with bias 89 | // 32 cards give 5 bits each 90 | // 16 cards give 4 bits each 91 | // 4 cards give 2 bits each 92 | // Average (32*5 + 16*4 + 4*2) / 52 = 4.46 bits per card without bias 93 | "card": { 94 | "ac": "00000", 95 | "2c": "00001", 96 | "3c": "00010", 97 | "4c": "00011", 98 | "5c": "00100", 99 | "6c": "00101", 100 | "7c": "00110", 101 | "8c": "00111", 102 | "9c": "01000", 103 | "tc": "01001", 104 | "jc": "01010", 105 | "qc": "01011", 106 | "kc": "01100", 107 | "ad": "01101", 108 | "2d": "01110", 109 | "3d": "01111", 110 | "4d": "10000", 111 | "5d": "10001", 112 | "6d": "10010", 113 | "7d": "10011", 114 | "8d": "10100", 115 | "9d": "10101", 116 | "td": "10110", 117 | "jd": "10111", 118 | "qd": "11000", 119 | "kd": "11001", 120 | "ah": "11010", 121 | "2h": "11011", 122 | "3h": "11100", 123 | "4h": "11101", 124 | "5h": "11110", 125 | "6h": "11111", 126 | "7h": "0000", 127 | "8h": "0001", 128 | "9h": "0010", 129 | "th": "0011", 130 | "jh": "0100", 131 | "qh": "0101", 132 | "kh": "0110", 133 | "as": "0111", 134 | "2s": "1000", 135 | "3s": "1001", 136 | "4s": "1010", 137 | "5s": "1011", 138 | "6s": "1100", 139 | "7s": "1101", 140 | "8s": "1110", 141 | "9s": "1111", 142 | "ts": "00", 143 | "js": "01", 144 | "qs": "10", 145 | "ks": "11", 146 | }, 147 | 148 | } 149 | 150 | // matchers returns an array of the matched events for each type of entropy. 151 | // eg 152 | // matchers.binary("010") returns ["0", "1", "0"] 153 | // matchers.binary("a10") returns ["1", "0"] 154 | // matchers.hex("a10") returns ["a", "1", "0"] 155 | var matchers = { 156 | binary: function(str) { 157 | return str.match(/[0-1]/gi) || []; 158 | }, 159 | base6: function(str) { 160 | return str.match(/[0-5]/gi) || []; 161 | }, 162 | dice: function(str) { 163 | return str.match(/[1-6]/gi) || []; // ie dice numbers 164 | }, 165 | base10: function(str) { 166 | return str.match(/[0-9]/gi) || []; 167 | }, 168 | hex: function(str) { 169 | return str.match(/[0-9A-F]/gi) || []; 170 | }, 171 | card: function(str) { 172 | // Format is NumberSuit, eg 173 | // AH ace of hearts 174 | // 8C eight of clubs 175 | // TD ten of diamonds 176 | // JS jack of spades 177 | // QH queen of hearts 178 | // KC king of clubs 179 | return str.match(/([A2-9TJQK][CDHS])/gi) || []; 180 | } 181 | } 182 | 183 | this.fromString = function(rawEntropyStr, baseStr) { 184 | // Find type of entropy being used (binary, hex, dice etc) 185 | var base = getBase(rawEntropyStr, baseStr); 186 | // Convert dice to base6 entropy (ie 1-6 to 0-5) 187 | // This is done by changing all 6s to 0s 188 | if (base.str == "dice") { 189 | var newEvents = []; 190 | for (var i=0; i -1) { 193 | newEvents[i] = base.events[i]; 194 | } 195 | else { 196 | newEvents[i] = "0"; 197 | } 198 | } 199 | base.str = "base 6 (dice)"; 200 | base.events = newEvents; 201 | base.matcher = matchers.base6; 202 | } 203 | // Detect empty entropy 204 | if (base.events.length == 0) { 205 | return { 206 | binaryStr: "", 207 | cleanStr: "", 208 | cleanHtml: "", 209 | base: base, 210 | }; 211 | } 212 | // Convert entropy events to binary 213 | var entropyBin = base.events.map(function(e) { 214 | return eventBits[base.str][e.toLowerCase()]; 215 | }).join(""); 216 | // Get average bits per event 217 | // which may be adjusted for bias if log2(base) is fractional 218 | var bitsPerEvent = base.bitsPerEvent; 219 | // Supply a 'filtered' entropy string for display purposes 220 | var entropyClean = base.events.join(""); 221 | var entropyHtml = base.events.join(""); 222 | if (base.asInt == 52) { 223 | entropyClean = base.events.join(" ").toUpperCase(); 224 | entropyClean = entropyClean.replace(/C/g, "\u2663"); 225 | entropyClean = entropyClean.replace(/D/g, "\u2666"); 226 | entropyClean = entropyClean.replace(/H/g, "\u2665"); 227 | entropyClean = entropyClean.replace(/S/g, "\u2660"); 228 | entropyHtml = base.events.join(" ").toUpperCase(); 229 | entropyHtml = entropyHtml.replace(/C/g, "\u2663"); 230 | entropyHtml = entropyHtml.replace(/D/g, "\u2666"); 231 | entropyHtml = entropyHtml.replace(/H/g, "\u2665"); 232 | entropyHtml = entropyHtml.replace(/S/g, "\u2660"); 233 | } 234 | // Return the result 235 | var e = { 236 | binaryStr: entropyBin, 237 | cleanStr: entropyClean, 238 | cleanHtml: entropyHtml, 239 | bitsPerEvent: bitsPerEvent, 240 | base: base, 241 | } 242 | return e; 243 | } 244 | 245 | function getBase(str, baseStr) { 246 | // Need to get the lowest base for the supplied entropy. 247 | // This prevents interpreting, say, dice rolls as hexadecimal. 248 | var binaryMatches = matchers.binary(str); 249 | var hexMatches = matchers.hex(str); 250 | var autodetect = baseStr === undefined; 251 | // Find the lowest base that can be used, whilst ignoring any irrelevant chars 252 | if ((binaryMatches.length == hexMatches.length && hexMatches.length > 0 && autodetect) || baseStr === "binary") { 253 | var ints = binaryMatches.map(function(i) { return parseInt(i, 2) }); 254 | return { 255 | ints: ints, 256 | events: binaryMatches, 257 | matcher: matchers.binary, 258 | asInt: 2, 259 | bitsPerEvent: 1, 260 | str: "binary", 261 | } 262 | } 263 | var cardMatches = matchers.card(str); 264 | if ((cardMatches.length >= hexMatches.length / 2 && autodetect) || baseStr === "card") { 265 | return { 266 | ints: ints, 267 | events: cardMatches, 268 | matcher: matchers.card, 269 | asInt: 52, 270 | bitsPerEvent: (32*5 + 16*4 + 4*2) / 52, // see cardBits 271 | str: "card", 272 | } 273 | } 274 | var diceMatches = matchers.dice(str); 275 | if ((diceMatches.length == hexMatches.length && hexMatches.length > 0 && autodetect) || baseStr === "dice") { 276 | var ints = diceMatches.map(function(i) { return parseInt(i) }); 277 | return { 278 | ints: ints, 279 | events: diceMatches, 280 | matcher: matchers.dice, 281 | asInt: 6, 282 | bitsPerEvent: (4*2 + 2*1) / 6, // see diceBits 283 | str: "dice", 284 | } 285 | } 286 | var base6Matches = matchers.base6(str); 287 | if ((base6Matches.length == hexMatches.length && hexMatches.length > 0 && autodetect) || baseStr === "base 6") { 288 | var ints = base6Matches.map(function(i) { return parseInt(i) }); 289 | return { 290 | ints: ints, 291 | events: base6Matches, 292 | matcher: matchers.base6, 293 | asInt: 6, 294 | bitsPerEvent: (4*2 + 2*1) / 6, // see diceBits 295 | str: "base 6", 296 | } 297 | } 298 | var base10Matches = matchers.base10(str); 299 | if ((base10Matches.length == hexMatches.length && hexMatches.length > 0 && autodetect) || baseStr === "base 10") { 300 | var ints = base10Matches.map(function(i) { return parseInt(i) }); 301 | return { 302 | ints: ints, 303 | events: base10Matches, 304 | matcher: matchers.base10, 305 | asInt: 10, 306 | bitsPerEvent: (8*3 + 2*1) / 10, // see b10Bits 307 | str: "base 10", 308 | } 309 | } 310 | var ints = hexMatches.map(function(i) { return parseInt(i, 16) }); 311 | return { 312 | ints: ints, 313 | events: hexMatches, 314 | matcher: matchers.hex, 315 | asInt: 16, 316 | bitsPerEvent: 4, 317 | str: "hexadecimal", 318 | } 319 | } 320 | 321 | })(); 322 | -------------------------------------------------------------------------------- /src/js/eos-util.js: -------------------------------------------------------------------------------- 1 | function EOSbufferToPublic(pubBuf) { 2 | const Buffer = libs.buffer.Buffer; 3 | const EOS_PUBLIC_PREFIX = "EOS"; 4 | let checksum = libs.createHash("rmd160").update(pubBuf).digest("hex").slice(0, 8); 5 | pubBuf = Buffer.concat([pubBuf, Buffer.from(checksum, "hex")]); 6 | return EOS_PUBLIC_PREFIX.concat(libs.bs58.encode(pubBuf)); 7 | } 8 | 9 | function EOSbufferToPrivate(privBuf) { 10 | const Buffer = libs.buffer.Buffer; 11 | const EOS_PRIVATE_PREFIX = "80"; 12 | privBuf = Buffer.concat([Buffer.from(EOS_PRIVATE_PREFIX, "hex"), privBuf]); 13 | let tmp = libs.createHash("sha256").update(privBuf).digest(); 14 | let checksum = libs.createHash("sha256").update(tmp).digest("hex").slice(0, 8); 15 | privBuf = Buffer.concat([privBuf, Buffer.from(checksum, "hex")]); 16 | return libs.bs58.encode(privBuf); 17 | } 18 | -------------------------------------------------------------------------------- /src/js/fio-util.js: -------------------------------------------------------------------------------- 1 | function FIObufferToPublic(pubBuf) { 2 | const Buffer = libs.buffer.Buffer; 3 | const FIO_PUBLIC_PREFIX = "FIO"; 4 | 5 | let checksum = libs.createHash("rmd160").update(pubBuf).digest("hex").slice(0, 8); 6 | pubBuf = Buffer.concat([pubBuf, Buffer.from(checksum, "hex")]); 7 | return FIO_PUBLIC_PREFIX.concat(libs.bs58.encode(pubBuf)); 8 | } 9 | 10 | function FIObufferToPrivate(privBuf) { 11 | const Buffer = libs.buffer.Buffer; 12 | const FIO_PRIVATE_PREFIX = "80"; 13 | 14 | privBuf = Buffer.concat([Buffer.from(FIO_PRIVATE_PREFIX, "hex"), privBuf]); 15 | let tmp = libs.createHash("sha256").update(privBuf).digest(); 16 | let checksum = libs.createHash("sha256").update(tmp).digest("hex").slice(0, 8); 17 | privBuf = Buffer.concat([privBuf, Buffer.from(checksum, "hex")]); 18 | return libs.bs58.encode(privBuf); 19 | } -------------------------------------------------------------------------------- /src/js/jingtum-util.js: -------------------------------------------------------------------------------- 1 | function convertJingtumAdrr(address) { 2 | return libs.basex('jpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65rkm8oFqi1tuvAxyz').encode( 3 | libs.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(address) 4 | ) 5 | } 6 | 7 | function convertJingtumPriv(priv) { 8 | return libs.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(priv).toString("hex").slice(2,66) 9 | } 10 | 11 | -------------------------------------------------------------------------------- /src/js/jsbip39.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Pavol Rusnak 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | * this software and associated documentation files (the "Software"), to deal in 6 | * the Software without restriction, including without limitation the rights to 7 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 8 | * of the Software, and to permit persons to whom the Software is furnished to do 9 | * so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in all 12 | * copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | */ 21 | 22 | /* 23 | * Javascript port from python by Ian Coleman 24 | * 25 | * Requires code from sjcl 26 | * https://github.com/bitwiseshiftleft/sjcl 27 | */ 28 | 29 | var Mnemonic = function(language) { 30 | 31 | var DOM = {}; 32 | DOM.entropyContainer = $(".entropy-container"); 33 | PBKDF2_ROUNDS = DOM.entropyContainer.find(".pbkdf2-rounds").val(); 34 | var RADIX = 2048; 35 | 36 | var self = this; 37 | var wordlist = []; 38 | 39 | var hmacSHA512 = function(key) { 40 | var hasher = new sjcl.misc.hmac(key, sjcl.hash.sha512); 41 | this.encrypt = function() { 42 | return hasher.encrypt.apply(hasher, arguments); 43 | }; 44 | }; 45 | 46 | function init() { 47 | wordlist = WORDLISTS[language]; 48 | if (wordlist.length != RADIX) { 49 | err = 'Wordlist should contain ' + RADIX + ' words, but it contains ' + wordlist.length + ' words.'; 50 | throw err; 51 | } 52 | } 53 | 54 | self.generate = function(strength) { 55 | strength = strength || 128; 56 | var r = strength % 32; 57 | if (r > 0) { 58 | throw 'Strength should be divisible by 32, but it is not (' + r + ').'; 59 | } 60 | var hasStrongCrypto = 'crypto' in window && window['crypto'] !== null; 61 | if (!hasStrongCrypto) { 62 | throw 'Mnemonic should be generated with strong randomness, but crypto.getRandomValues is unavailable'; 63 | } 64 | var buffer = new Uint8Array(strength / 8); 65 | var data = crypto.getRandomValues(buffer); 66 | return self.toMnemonic(data); 67 | } 68 | 69 | self.toMnemonic = function(byteArray) { 70 | if (byteArray.length % 4 > 0) { 71 | throw 'Data length in bits should be divisible by 32, but it is not (' + byteArray.length + ' bytes = ' + byteArray.length*8 + ' bits).' 72 | } 73 | 74 | //h = hashlib.sha256(data).hexdigest() 75 | var data = byteArrayToWordArray(byteArray); 76 | var hash = sjcl.hash.sha256.hash(data); 77 | var h = sjcl.codec.hex.fromBits(hash); 78 | 79 | // b is a binary string, eg '00111010101100...' 80 | //b = bin(int(binascii.hexlify(data), 16))[2:].zfill(len(data) * 8) + \ 81 | // bin(int(h, 16))[2:].zfill(256)[:len(data) * 8 / 32] 82 | // 83 | // a = bin(int(binascii.hexlify(data), 16))[2:].zfill(len(data) * 8) 84 | // c = bin(int(h, 16))[2:].zfill(256) 85 | // d = c[:len(data) * 8 / 32] 86 | var a = byteArrayToBinaryString(byteArray); 87 | var c = zfill(hexStringToBinaryString(h), 256); 88 | var d = c.substring(0, byteArray.length * 8 / 32); 89 | // b = line1 + line2 90 | var b = a + d; 91 | 92 | var result = []; 93 | var blen = b.length / 11; 94 | for (var i=0; i 0) { 216 | return null; 217 | } 218 | // idx = map(lambda x: bin(self.wordlist.index(x))[2:].zfill(11), mnemonic) 219 | var idx = []; 220 | for (var i=0; i=0.10.0" 149 | } 150 | }, 151 | "node_modules/pako": { 152 | "version": "1.0.11", 153 | "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", 154 | "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" 155 | }, 156 | "node_modules/path-is-absolute": { 157 | "version": "1.0.1", 158 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 159 | "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", 160 | "engines": { 161 | "node": ">=0.10.0" 162 | } 163 | }, 164 | "node_modules/process-nextick-args": { 165 | "version": "2.0.1", 166 | "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", 167 | "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" 168 | }, 169 | "node_modules/readable-stream": { 170 | "version": "2.3.7", 171 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", 172 | "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", 173 | "dependencies": { 174 | "core-util-is": "~1.0.0", 175 | "inherits": "~2.0.3", 176 | "isarray": "~1.0.0", 177 | "process-nextick-args": "~2.0.0", 178 | "safe-buffer": "~5.1.1", 179 | "string_decoder": "~1.1.1", 180 | "util-deprecate": "~1.0.1" 181 | } 182 | }, 183 | "node_modules/rimraf": { 184 | "version": "2.7.1", 185 | "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", 186 | "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", 187 | "dependencies": { 188 | "glob": "^7.1.3" 189 | }, 190 | "bin": { 191 | "rimraf": "bin.js" 192 | } 193 | }, 194 | "node_modules/safe-buffer": { 195 | "version": "5.1.2", 196 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 197 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 198 | }, 199 | "node_modules/sax": { 200 | "version": "1.2.4", 201 | "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", 202 | "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" 203 | }, 204 | "node_modules/selenium-webdriver": { 205 | "version": "3.6.0", 206 | "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-3.6.0.tgz", 207 | "integrity": "sha512-WH7Aldse+2P5bbFBO4Gle/nuQOdVwpHMTL6raL3uuBj/vPG07k6uzt3aiahu352ONBr5xXh0hDlM3LhtXPOC4Q==", 208 | "dependencies": { 209 | "jszip": "^3.1.3", 210 | "rimraf": "^2.5.4", 211 | "tmp": "0.0.30", 212 | "xml2js": "^0.4.17" 213 | }, 214 | "engines": { 215 | "node": ">= 6.9.0" 216 | } 217 | }, 218 | "node_modules/set-immediate-shim": { 219 | "version": "1.0.1", 220 | "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", 221 | "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=", 222 | "engines": { 223 | "node": ">=0.10.0" 224 | } 225 | }, 226 | "node_modules/string_decoder": { 227 | "version": "1.1.1", 228 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", 229 | "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", 230 | "dependencies": { 231 | "safe-buffer": "~5.1.0" 232 | } 233 | }, 234 | "node_modules/tmp": { 235 | "version": "0.0.30", 236 | "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.30.tgz", 237 | "integrity": "sha1-ckGdSovn1s51FI/YsyTlk6cRwu0=", 238 | "dependencies": { 239 | "os-tmpdir": "~1.0.1" 240 | }, 241 | "engines": { 242 | "node": ">=0.4.0" 243 | } 244 | }, 245 | "node_modules/util-deprecate": { 246 | "version": "1.0.2", 247 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 248 | "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" 249 | }, 250 | "node_modules/wrappy": { 251 | "version": "1.0.2", 252 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 253 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" 254 | }, 255 | "node_modules/xml2js": { 256 | "version": "0.4.23", 257 | "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", 258 | "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", 259 | "dependencies": { 260 | "sax": ">=0.6.0", 261 | "xmlbuilder": "~11.0.0" 262 | }, 263 | "engines": { 264 | "node": ">=4.0.0" 265 | } 266 | }, 267 | "node_modules/xmlbuilder": { 268 | "version": "11.0.1", 269 | "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", 270 | "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", 271 | "engines": { 272 | "node": ">=4.0" 273 | } 274 | } 275 | }, 276 | "dependencies": { 277 | "balanced-match": { 278 | "version": "1.0.2", 279 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", 280 | "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" 281 | }, 282 | "brace-expansion": { 283 | "version": "1.1.11", 284 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 285 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 286 | "requires": { 287 | "balanced-match": "^1.0.0", 288 | "concat-map": "0.0.1" 289 | } 290 | }, 291 | "concat-map": { 292 | "version": "0.0.1", 293 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 294 | "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" 295 | }, 296 | "core-util-is": { 297 | "version": "1.0.3", 298 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", 299 | "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" 300 | }, 301 | "fs.realpath": { 302 | "version": "1.0.0", 303 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 304 | "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" 305 | }, 306 | "glob": { 307 | "version": "7.2.0", 308 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", 309 | "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", 310 | "requires": { 311 | "fs.realpath": "^1.0.0", 312 | "inflight": "^1.0.4", 313 | "inherits": "2", 314 | "minimatch": "^3.0.4", 315 | "once": "^1.3.0", 316 | "path-is-absolute": "^1.0.0" 317 | } 318 | }, 319 | "immediate": { 320 | "version": "3.0.6", 321 | "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", 322 | "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=" 323 | }, 324 | "inflight": { 325 | "version": "1.0.6", 326 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 327 | "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", 328 | "requires": { 329 | "once": "^1.3.0", 330 | "wrappy": "1" 331 | } 332 | }, 333 | "inherits": { 334 | "version": "2.0.4", 335 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 336 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 337 | }, 338 | "isarray": { 339 | "version": "1.0.0", 340 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 341 | "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" 342 | }, 343 | "jasmine": { 344 | "version": "3.9.0", 345 | "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.9.0.tgz", 346 | "integrity": "sha512-JgtzteG7xnqZZ51fg7N2/wiQmXon09szkALcRMTgCMX4u/m17gVJFjObnvw5FXkZOWuweHPaPRVB6DI2uN0wVA==", 347 | "requires": { 348 | "glob": "^7.1.6", 349 | "jasmine-core": "~3.9.0" 350 | } 351 | }, 352 | "jasmine-core": { 353 | "version": "3.9.0", 354 | "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.9.0.tgz", 355 | "integrity": "sha512-Tv3kVbPCGVrjsnHBZ38NsPU3sDOtNa0XmbG2baiyJqdb5/SPpDO6GVwJYtUryl6KB4q1Ssckwg612ES9Z0dreQ==" 356 | }, 357 | "jszip": { 358 | "version": "3.7.1", 359 | "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.7.1.tgz", 360 | "integrity": "sha512-ghL0tz1XG9ZEmRMcEN2vt7xabrDdqHHeykgARpmZ0BiIctWxM47Vt63ZO2dnp4QYt/xJVLLy5Zv1l/xRdh2byg==", 361 | "requires": { 362 | "lie": "~3.3.0", 363 | "pako": "~1.0.2", 364 | "readable-stream": "~2.3.6", 365 | "set-immediate-shim": "~1.0.1" 366 | } 367 | }, 368 | "lie": { 369 | "version": "3.3.0", 370 | "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", 371 | "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", 372 | "requires": { 373 | "immediate": "~3.0.5" 374 | } 375 | }, 376 | "minimatch": { 377 | "version": "3.0.4", 378 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", 379 | "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", 380 | "requires": { 381 | "brace-expansion": "^1.1.7" 382 | } 383 | }, 384 | "once": { 385 | "version": "1.4.0", 386 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 387 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", 388 | "requires": { 389 | "wrappy": "1" 390 | } 391 | }, 392 | "os-tmpdir": { 393 | "version": "1.0.2", 394 | "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", 395 | "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" 396 | }, 397 | "pako": { 398 | "version": "1.0.11", 399 | "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", 400 | "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" 401 | }, 402 | "path-is-absolute": { 403 | "version": "1.0.1", 404 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 405 | "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" 406 | }, 407 | "process-nextick-args": { 408 | "version": "2.0.1", 409 | "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", 410 | "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" 411 | }, 412 | "readable-stream": { 413 | "version": "2.3.7", 414 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", 415 | "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", 416 | "requires": { 417 | "core-util-is": "~1.0.0", 418 | "inherits": "~2.0.3", 419 | "isarray": "~1.0.0", 420 | "process-nextick-args": "~2.0.0", 421 | "safe-buffer": "~5.1.1", 422 | "string_decoder": "~1.1.1", 423 | "util-deprecate": "~1.0.1" 424 | } 425 | }, 426 | "rimraf": { 427 | "version": "2.7.1", 428 | "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", 429 | "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", 430 | "requires": { 431 | "glob": "^7.1.3" 432 | } 433 | }, 434 | "safe-buffer": { 435 | "version": "5.1.2", 436 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 437 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 438 | }, 439 | "sax": { 440 | "version": "1.2.4", 441 | "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", 442 | "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" 443 | }, 444 | "selenium-webdriver": { 445 | "version": "3.6.0", 446 | "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-3.6.0.tgz", 447 | "integrity": "sha512-WH7Aldse+2P5bbFBO4Gle/nuQOdVwpHMTL6raL3uuBj/vPG07k6uzt3aiahu352ONBr5xXh0hDlM3LhtXPOC4Q==", 448 | "requires": { 449 | "jszip": "^3.1.3", 450 | "rimraf": "^2.5.4", 451 | "tmp": "0.0.30", 452 | "xml2js": "^0.4.17" 453 | } 454 | }, 455 | "set-immediate-shim": { 456 | "version": "1.0.1", 457 | "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", 458 | "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=" 459 | }, 460 | "string_decoder": { 461 | "version": "1.1.1", 462 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", 463 | "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", 464 | "requires": { 465 | "safe-buffer": "~5.1.0" 466 | } 467 | }, 468 | "tmp": { 469 | "version": "0.0.30", 470 | "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.30.tgz", 471 | "integrity": "sha1-ckGdSovn1s51FI/YsyTlk6cRwu0=", 472 | "requires": { 473 | "os-tmpdir": "~1.0.1" 474 | } 475 | }, 476 | "util-deprecate": { 477 | "version": "1.0.2", 478 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 479 | "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" 480 | }, 481 | "wrappy": { 482 | "version": "1.0.2", 483 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 484 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" 485 | }, 486 | "xml2js": { 487 | "version": "0.4.23", 488 | "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", 489 | "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", 490 | "requires": { 491 | "sax": ">=0.6.0", 492 | "xmlbuilder": "~11.0.0" 493 | } 494 | }, 495 | "xmlbuilder": { 496 | "version": "11.0.1", 497 | "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", 498 | "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==" 499 | } 500 | } 501 | } 502 | -------------------------------------------------------------------------------- /tests/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tests", 3 | "version": "1.0.0", 4 | "scripts": { 5 | "test": "jasmine spec/tests.js" 6 | }, 7 | "author": "Ian coleman", 8 | "description": "Tests for BIP39 tool", 9 | "repository": { 10 | "type": "git", 11 | "url": "git://github.com/iancoleman/bip39.git" 12 | }, 13 | "dependencies": { 14 | "jasmine": "^3.9.0", 15 | "selenium-webdriver": "^3.6.0" 16 | }, 17 | "license": "MIT" 18 | } 19 | -------------------------------------------------------------------------------- /tests/spec/support/jasmine.json: -------------------------------------------------------------------------------- 1 | { 2 | "spec_dir": "spec", 3 | "spec_files": [ 4 | "**/*[sS]pec.js" 5 | ], 6 | "helpers": [ 7 | "helpers/**/*.js" 8 | ], 9 | "stopSpecOnExpectationFailure": false, 10 | "random": false 11 | } 12 | --------------------------------------------------------------------------------