diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/index.html | 24 | ||||
-rw-r--r-- | src/js/index.js | 5 |
2 files changed, 19 insertions, 10 deletions
diff --git a/src/index.html b/src/index.html index 1699b39..16d93e6 100644 --- a/src/index.html +++ b/src/index.html | |||
@@ -3,7 +3,7 @@ | |||
3 | <head lang="en"> | 3 | <head lang="en"> |
4 | <meta charset="utf-8" /> | 4 | <meta charset="utf-8" /> |
5 | <title>BIP39 - Mnemonic Code</title> | 5 | <title>BIP39 - Mnemonic Code</title> |
6 | <link rel="stylesheet" href="/css/bootstrap.min.css"> | 6 | <link rel="stylesheet" href="css/bootstrap.min.css"> |
7 | <meta content="Mnemonic code for generating deterministic keys" name="description"/> | 7 | <meta content="Mnemonic code for generating deterministic keys" name="description"/> |
8 | <meta content="width=device-width, initial-scale=1.0" name="viewport" /> | 8 | <meta content="width=device-width, initial-scale=1.0" name="viewport" /> |
9 | <meta content="bitcoin mnemonic converter" name="description" /> | 9 | <meta content="bitcoin mnemonic converter" name="description" /> |
@@ -89,6 +89,12 @@ | |||
89 | </div> | 89 | </div> |
90 | </div> | 90 | </div> |
91 | <div class="form-group"> | 91 | <div class="form-group"> |
92 | <label for="seed" class="col-sm-2 control-label">BIP39 Seed</label> | ||
93 | <div class="col-sm-10"> | ||
94 | <textarea id="seed" class="seed form-control" readonly="readonly"></textarea> | ||
95 | </div> | ||
96 | </div> | ||
97 | <div class="form-group"> | ||
92 | <label for="network-phrase" class="col-sm-2 control-label">Coin</label> | 98 | <label for="network-phrase" class="col-sm-2 control-label">Coin</label> |
93 | <div class="col-sm-10"> | 99 | <div class="col-sm-10"> |
94 | <select id="network-phrase" class="network form-control"> | 100 | <select id="network-phrase" class="network form-control"> |
@@ -385,13 +391,13 @@ | |||
385 | <td class="privkey"><span></span></td> | 391 | <td class="privkey"><span></span></td> |
386 | </tr> | 392 | </tr> |
387 | </script> | 393 | </script> |
388 | <script src="/js/jquery.min.js"></script> | 394 | <script src="js/jquery.min.js"></script> |
389 | <script src="/js/bootstrap.min.js"></script> | 395 | <script src="js/bootstrap.min.js"></script> |
390 | <script src="/js/bitcoinjs-1-5-7.js"></script> | 396 | <script src="js/bitcoinjs-1-5-7.js"></script> |
391 | <script src="/js/bitcoinjs-extensions.js"></script> | 397 | <script src="js/bitcoinjs-extensions.js"></script> |
392 | <script src="/js/sjcl-bip39.js"></script> | 398 | <script src="js/sjcl-bip39.js"></script> |
393 | <script src="/js/wordlist_english.js"></script> | 399 | <script src="js/wordlist_english.js"></script> |
394 | <script src="/js/jsbip39.js"></script> | 400 | <script src="js/jsbip39.js"></script> |
395 | <script src="/js/index.js"></script> | 401 | <script src="js/index.js"></script> |
396 | </body> | 402 | </body> |
397 | </html> | 403 | </html> |
diff --git a/src/js/index.js b/src/js/index.js index 9dabe95..4f1ab24 100644 --- a/src/js/index.js +++ b/src/js/index.js | |||
@@ -1,6 +1,7 @@ | |||
1 | (function() { | 1 | (function() { |
2 | 2 | ||
3 | var mnemonic = new Mnemonic("english"); | 3 | var mnemonic = new Mnemonic("english"); |
4 | var seed = null | ||
4 | var bip32RootKey = null; | 5 | var bip32RootKey = null; |
5 | var bip32ExtendedKey = null; | 6 | var bip32ExtendedKey = null; |
6 | var network = bitcoin.networks.bitcoin; | 7 | var network = bitcoin.networks.bitcoin; |
@@ -18,6 +19,7 @@ | |||
18 | DOM.phrase = $(".phrase"); | 19 | DOM.phrase = $(".phrase"); |
19 | DOM.passphrase = $(".passphrase"); | 20 | DOM.passphrase = $(".passphrase"); |
20 | DOM.generate = $(".generate"); | 21 | DOM.generate = $(".generate"); |
22 | DOM.seed = $(".seed"); | ||
21 | DOM.rootKey = $(".root-key"); | 23 | DOM.rootKey = $(".root-key"); |
22 | DOM.extendedPrivKey = $(".extended-priv-key"); | 24 | DOM.extendedPrivKey = $(".extended-priv-key"); |
23 | DOM.extendedPubKey = $(".extended-pub-key"); | 25 | DOM.extendedPubKey = $(".extended-pub-key"); |
@@ -169,7 +171,7 @@ | |||
169 | } | 171 | } |
170 | 172 | ||
171 | function calcBip32Seed(phrase, passphrase, path) { | 173 | function calcBip32Seed(phrase, passphrase, path) { |
172 | var seed = mnemonic.toSeed(phrase, passphrase); | 174 | seed = mnemonic.toSeed(phrase, passphrase); |
173 | bip32RootKey = bitcoin.HDNode.fromSeedHex(seed, network); | 175 | bip32RootKey = bitcoin.HDNode.fromSeedHex(seed, network); |
174 | bip32ExtendedKey = bip32RootKey; | 176 | bip32ExtendedKey = bip32RootKey; |
175 | // Derive the key from the path | 177 | // Derive the key from the path |
@@ -232,6 +234,7 @@ | |||
232 | 234 | ||
233 | function displayBip32Info() { | 235 | function displayBip32Info() { |
234 | // Display the key | 236 | // Display the key |
237 | DOM.seed.val(seed); | ||
235 | var rootKey = bip32RootKey.toBase58(); | 238 | var rootKey = bip32RootKey.toBase58(); |
236 | DOM.rootKey.val(rootKey); | 239 | DOM.rootKey.val(rootKey); |
237 | var extendedPrivKey = bip32ExtendedKey.toBase58(); | 240 | var extendedPrivKey = bip32ExtendedKey.toBase58(); |