diff options
Diffstat (limited to 'bip39-standalone.html')
-rw-r--r-- | bip39-standalone.html | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/bip39-standalone.html b/bip39-standalone.html index 0bb89f5..2948ed2 100644 --- a/bip39-standalone.html +++ b/bip39-standalone.html | |||
@@ -74,6 +74,12 @@ | |||
74 | </div> | 74 | </div> |
75 | </div> | 75 | </div> |
76 | <div class="form-group"> | 76 | <div class="form-group"> |
77 | <label for="passphrase" class="col-sm-2 control-label">BIP39 Passphrase (optional)</label> | ||
78 | <div class="col-sm-10"> | ||
79 | <textarea id="passphrase" class="passphrase form-control"></textarea> | ||
80 | </div> | ||
81 | </div> | ||
82 | <div class="form-group"> | ||
77 | <label for="root-key" class="col-sm-2 control-label">BIP32 Root Key</label> | 83 | <label for="root-key" class="col-sm-2 control-label">BIP32 Root Key</label> |
78 | <div class="col-sm-10"> | 84 | <div class="col-sm-10"> |
79 | <textarea id="root-key" class="root-key form-control" disabled="disabled"></textarea> | 85 | <textarea id="root-key" class="root-key form-control" disabled="disabled"></textarea> |
@@ -22775,6 +22781,7 @@ WORDLISTS = { | |||
22775 | 22781 | ||
22776 | var DOM = {}; | 22782 | var DOM = {}; |
22777 | DOM.phrase = $(".phrase"); | 22783 | DOM.phrase = $(".phrase"); |
22784 | DOM.passphrase = $(".passphrase"); | ||
22778 | DOM.generate = $(".generate"); | 22785 | DOM.generate = $(".generate"); |
22779 | DOM.rootKey = $(".root-key"); | 22786 | DOM.rootKey = $(".root-key"); |
22780 | DOM.extendedPrivKey = $(".extended-priv-key"); | 22787 | DOM.extendedPrivKey = $(".extended-priv-key"); |
@@ -22800,6 +22807,7 @@ WORDLISTS = { | |||
22800 | function init() { | 22807 | function init() { |
22801 | // Events | 22808 | // Events |
22802 | DOM.phrase.on("keyup", delayedPhraseChanged); | 22809 | DOM.phrase.on("keyup", delayedPhraseChanged); |
22810 | DOM.passphrase.on("keyup", delayedPhraseChanged); | ||
22803 | DOM.generate.on("click", generateClicked); | 22811 | DOM.generate.on("click", generateClicked); |
22804 | DOM.more.on("click", showMore); | 22812 | DOM.more.on("click", showMore); |
22805 | DOM.bip32path.on("keyup", bip32Changed); | 22813 | DOM.bip32path.on("keyup", bip32Changed); |
@@ -22832,6 +22840,7 @@ WORDLISTS = { | |||
22832 | hideValidationError(); | 22840 | hideValidationError(); |
22833 | // Get the mnemonic phrase | 22841 | // Get the mnemonic phrase |
22834 | var phrase = DOM.phrase.val(); | 22842 | var phrase = DOM.phrase.val(); |
22843 | var passphrase = DOM.passphrase.val(); | ||
22835 | var errorText = findPhraseErrors(phrase); | 22844 | var errorText = findPhraseErrors(phrase); |
22836 | if (errorText) { | 22845 | if (errorText) { |
22837 | showValidationError(errorText); | 22846 | showValidationError(errorText); |
@@ -22844,7 +22853,7 @@ WORDLISTS = { | |||
22844 | return; | 22853 | return; |
22845 | } | 22854 | } |
22846 | // Calculate and display | 22855 | // Calculate and display |
22847 | calcBip32Seed(phrase, derivationPath); | 22856 | calcBip32Seed(phrase, passphrase, derivationPath); |
22848 | displayBip32Info(); | 22857 | displayBip32Info(); |
22849 | hidePending(); | 22858 | hidePending(); |
22850 | } | 22859 | } |
@@ -22924,8 +22933,8 @@ WORDLISTS = { | |||
22924 | return words; | 22933 | return words; |
22925 | } | 22934 | } |
22926 | 22935 | ||
22927 | function calcBip32Seed(phrase, path) { | 22936 | function calcBip32Seed(phrase, passphrase, path) { |
22928 | var seed = mnemonic.toSeed(phrase); | 22937 | var seed = mnemonic.toSeed(phrase, passphrase); |
22929 | var seedHash = Bitcoin.crypto.sha256(seed).toString("hex"); | 22938 | var seedHash = Bitcoin.crypto.sha256(seed).toString("hex"); |
22930 | bip32RootKey = Bitcoin.HDNode.fromSeedHex(seedHash, network); | 22939 | bip32RootKey = Bitcoin.HDNode.fromSeedHex(seedHash, network); |
22931 | bip32ExtendedKey = bip32RootKey; | 22940 | bip32ExtendedKey = bip32RootKey; |