diff options
author | Kirill Kovalenko <kirill.kovalenko@gmail.com> | 2016-03-18 20:28:33 +0100 |
---|---|---|
committer | Kirill Kovalenko <kirill.kovalenko@gmail.com> | 2016-03-18 20:28:33 +0100 |
commit | 3e0ed16a93761d6b706ddcc10ee37319fec43e36 (patch) | |
tree | 5c0575350f7ffa0b9234e4ed4e397736393d14da /src | |
parent | cee442b16b80490c3549b667068372fd28395593 (diff) | |
download | BIP39-3e0ed16a93761d6b706ddcc10ee37319fec43e36.tar.gz BIP39-3e0ed16a93761d6b706ddcc10ee37319fec43e36.tar.zst BIP39-3e0ed16a93761d6b706ddcc10ee37319fec43e36.zip |
Display BIP39 seed
Diffstat (limited to 'src')
-rw-r--r-- | src/index.html | 6 | ||||
-rw-r--r-- | src/js/index.js | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/index.html b/src/index.html index de652d8..16d93e6 100644 --- a/src/index.html +++ b/src/index.html | |||
@@ -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"> |
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(); |