]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/commitdiff
Support for optional passphrase in offline page
authorIan Coleman <coleman.ian@gmail.com>
Wed, 24 Sep 2014 23:27:25 +0000 (09:27 +1000)
committerIan Coleman <coleman.ian@gmail.com>
Wed, 24 Sep 2014 23:27:25 +0000 (09:27 +1000)
bip39-standalone.html

index 0bb89f5d4eec7e7037f9c538750d07f441d1c0e7..2948ed2b394b6c2773d75b4193eb39867ca8a46d 100644 (file)
                                 </div>
                             </div>
                         </div>
+                        <div class="form-group">
+                            <label for="passphrase" class="col-sm-2 control-label">BIP39 Passphrase (optional)</label>
+                            <div class="col-sm-10">
+                                <textarea id="passphrase" class="passphrase form-control"></textarea>
+                            </div>
+                        </div>
                         <div class="form-group">
                             <label for="root-key" class="col-sm-2 control-label">BIP32 Root Key</label>
                             <div class="col-sm-10">
@@ -22775,6 +22781,7 @@ WORDLISTS = {
 
     var DOM = {};
     DOM.phrase = $(".phrase");
+    DOM.passphrase = $(".passphrase");
     DOM.generate = $(".generate");
     DOM.rootKey = $(".root-key");
     DOM.extendedPrivKey = $(".extended-priv-key");
@@ -22800,6 +22807,7 @@ WORDLISTS = {
     function init() {
         // Events
         DOM.phrase.on("keyup", delayedPhraseChanged);
+        DOM.passphrase.on("keyup", delayedPhraseChanged);
         DOM.generate.on("click", generateClicked);
         DOM.more.on("click", showMore);
         DOM.bip32path.on("keyup", bip32Changed);
@@ -22832,6 +22840,7 @@ WORDLISTS = {
         hideValidationError();
         // Get the mnemonic phrase
         var phrase = DOM.phrase.val();
+        var passphrase = DOM.passphrase.val();
         var errorText = findPhraseErrors(phrase);
         if (errorText) {
             showValidationError(errorText);
@@ -22844,7 +22853,7 @@ WORDLISTS = {
             return;
         }
         // Calculate and display
-        calcBip32Seed(phrase, derivationPath);
+        calcBip32Seed(phrase, passphrase, derivationPath);
         displayBip32Info();
         hidePending();
     }
@@ -22924,8 +22933,8 @@ WORDLISTS = {
         return words;
     }
 
-    function calcBip32Seed(phrase, path) {
-        var seed = mnemonic.toSeed(phrase);
+    function calcBip32Seed(phrase, passphrase, path) {
+        var seed = mnemonic.toSeed(phrase, passphrase);
         var seedHash = Bitcoin.crypto.sha256(seed).toString("hex");
         bip32RootKey = Bitcoin.HDNode.fromSeedHex(seedHash, network);
         bip32ExtendedKey = bip32RootKey;