diff options
Diffstat (limited to 'src/js/index.js')
-rw-r--r-- | src/js/index.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/js/index.js b/src/js/index.js index 161f91f..cee8ffb 100644 --- a/src/js/index.js +++ b/src/js/index.js | |||
@@ -10,6 +10,7 @@ | |||
10 | 10 | ||
11 | var DOM = {}; | 11 | var DOM = {}; |
12 | DOM.phrase = $(".phrase"); | 12 | DOM.phrase = $(".phrase"); |
13 | DOM.passphrase = $(".passphrase"); | ||
13 | DOM.generate = $(".generate"); | 14 | DOM.generate = $(".generate"); |
14 | DOM.rootKey = $(".root-key"); | 15 | DOM.rootKey = $(".root-key"); |
15 | DOM.extendedPrivKey = $(".extended-priv-key"); | 16 | DOM.extendedPrivKey = $(".extended-priv-key"); |
@@ -35,6 +36,7 @@ | |||
35 | function init() { | 36 | function init() { |
36 | // Events | 37 | // Events |
37 | DOM.phrase.on("keyup", delayedPhraseChanged); | 38 | DOM.phrase.on("keyup", delayedPhraseChanged); |
39 | DOM.passphrase.on("keyup", delayedPhraseChanged); | ||
38 | DOM.generate.on("click", generateClicked); | 40 | DOM.generate.on("click", generateClicked); |
39 | DOM.more.on("click", showMore); | 41 | DOM.more.on("click", showMore); |
40 | DOM.bip32path.on("keyup", bip32Changed); | 42 | DOM.bip32path.on("keyup", bip32Changed); |
@@ -67,6 +69,7 @@ | |||
67 | hideValidationError(); | 69 | hideValidationError(); |
68 | // Get the mnemonic phrase | 70 | // Get the mnemonic phrase |
69 | var phrase = DOM.phrase.val(); | 71 | var phrase = DOM.phrase.val(); |
72 | var passphrase = DOM.passphrase.val(); | ||
70 | var errorText = findPhraseErrors(phrase); | 73 | var errorText = findPhraseErrors(phrase); |
71 | if (errorText) { | 74 | if (errorText) { |
72 | showValidationError(errorText); | 75 | showValidationError(errorText); |
@@ -79,7 +82,7 @@ | |||
79 | return; | 82 | return; |
80 | } | 83 | } |
81 | // Calculate and display | 84 | // Calculate and display |
82 | calcBip32Seed(phrase, derivationPath); | 85 | calcBip32Seed(phrase, passphrase, derivationPath); |
83 | displayBip32Info(); | 86 | displayBip32Info(); |
84 | hidePending(); | 87 | hidePending(); |
85 | } | 88 | } |
@@ -159,8 +162,8 @@ | |||
159 | return words; | 162 | return words; |
160 | } | 163 | } |
161 | 164 | ||
162 | function calcBip32Seed(phrase, path) { | 165 | function calcBip32Seed(phrase, passphrase, path) { |
163 | var seed = mnemonic.toSeed(phrase); | 166 | var seed = mnemonic.toSeed(phrase, passphrase); |
164 | var seedHash = Bitcoin.crypto.sha256(seed).toString("hex"); | 167 | var seedHash = Bitcoin.crypto.sha256(seed).toString("hex"); |
165 | bip32RootKey = Bitcoin.HDNode.fromSeedHex(seedHash, network); | 168 | bip32RootKey = Bitcoin.HDNode.fromSeedHex(seedHash, network); |
166 | bip32ExtendedKey = bip32RootKey; | 169 | bip32ExtendedKey = bip32RootKey; |