]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/commitdiff
Merge pull request #92 from jonspock/master
authoriancoleman <coleman.ian@gmail.com>
Tue, 22 Aug 2017 23:30:43 +0000 (09:30 +1000)
committerGitHub <noreply@github.com>
Tue, 22 Aug 2017 23:30:43 +0000 (09:30 +1000)
Add maza coin, update PIVX in bip39-standalone.html

bip39-standalone.html
changelog.md
src/index.html
src/js/index.js
tests.js

index c828bdcfcb4d2f6e42baa4388dc5324e0750d8a6..f1837776d0a20a1931591c2ad6d2d92050c8a8b1 100644 (file)
         <div class="container">
 
             <h1 class="text-center">Mnemonic Code Converter</h1>
-            <p class="version">v0.2.1</p>
+            <p class="version">v0.2.2</p>
             <hr>
             <div class="row">
                 <div class="col-md-12">
@@ -46272,6 +46272,10 @@ window.Entropy = new (function() {
 
     function delayedPhraseChanged() {
         hideValidationError();
+        seed = null;
+        bip32RootKey = null;
+        bip32ExtendedKey = null;
+        clearAddressesList();
         showPending();
         if (phraseChangeTimeoutEvent != null) {
             clearTimeout(phraseChangeTimeoutEvent);
@@ -46281,7 +46285,6 @@ window.Entropy = new (function() {
 
     function phraseChanged() {
         showPending();
-        hideValidationError();
         setMnemonicLanguage();
         // Get the mnemonic phrase
         var phrase = DOM.phrase.val();
@@ -46294,7 +46297,6 @@ window.Entropy = new (function() {
         var passphrase = DOM.passphrase.val();
         calcBip32RootKeyFromSeed(phrase, passphrase);
         calcForDerivationPath();
-        hidePending();
     }
 
     function delayedEntropyChanged() {
@@ -46370,10 +46372,9 @@ window.Entropy = new (function() {
     }
 
     function calcForDerivationPath() {
-        showPending();
         clearDerivedKeys();
         clearAddressesList();
-        hideValidationError();
+        showPending();
         // Don't show bip49 if it's selected but network doesn't support it
         if (bip49TabSelected() && !networkHasBip49()) {
             return;
@@ -46393,7 +46394,6 @@ window.Entropy = new (function() {
             displayBip49Info();
         }
         displayBip32Info();
-        hidePending();
     }
 
     function generateClicked() {
@@ -46700,17 +46700,19 @@ window.Entropy = new (function() {
                 for (var i=0; i<rows.length; i++) {
                     rows[i].shouldGenerate = false;
                 }
+                hidePending();
             }
 
             for (var i=0; i<total; i++) {
                 var index = i + start;
-                rows.push(new TableRow(index));
+                var isLast = i == total - 1;
+                rows.push(new TableRow(index, isLast));
             }
 
         })());
     }
 
-    function TableRow(index) {
+    function TableRow(index, isLast) {
 
         var self = this;
         this.shouldGenerate = true;
@@ -46772,6 +46774,9 @@ window.Entropy = new (function() {
                     address = bitcoinjs.bitcoin.address.fromOutputScript(scriptpubkey, network)
                 }
                 addAddressToList(indexText, address, pubkey, privkey);
+                if (isLast) {
+                    hidePending();
+                }
             }, 50)
         }
 
index be83e3ce736fcc4663c427fda965dc96331b796a..80792612290ffc337d3c46358d51afc677788cdf 100644 (file)
@@ -1,3 +1,9 @@
+# 0.2.2
+
+* Improve showing feedback for pending calculations
+* Bugfix: Clear old seed when mnemonic is changed
+* Add PIVX network
+
 # 0.2.1
 
 * BTC is the default coin
index f39ad1491325d5454aca4daab0bd24e57d82bbd5..5b1e2231be5bbf828100f15855269a95457d8dde 100644 (file)
         <div class="container">
 
             <h1 class="text-center">Mnemonic Code Converter</h1>
-            <p class="version">v0.2.1</p>
+            <p class="version">v0.2.2</p>
             <hr>
             <div class="row">
                 <div class="col-md-12">
index 79f4e4ccb4dbb48e200a403c124b7d5970db20eb..3a5a0ef3fecc7f4d804bc84bc118832c28f20527 100644 (file)
 
     function delayedPhraseChanged() {
         hideValidationError();
+        seed = null;
+        bip32RootKey = null;
+        bip32ExtendedKey = null;
+        clearAddressesList();
         showPending();
         if (phraseChangeTimeoutEvent != null) {
             clearTimeout(phraseChangeTimeoutEvent);
 
     function phraseChanged() {
         showPending();
-        hideValidationError();
         setMnemonicLanguage();
         // Get the mnemonic phrase
         var phrase = DOM.phrase.val();
         var passphrase = DOM.passphrase.val();
         calcBip32RootKeyFromSeed(phrase, passphrase);
         calcForDerivationPath();
-        hidePending();
     }
 
     function delayedEntropyChanged() {
     }
 
     function calcForDerivationPath() {
-        showPending();
         clearDerivedKeys();
         clearAddressesList();
-        hideValidationError();
+        showPending();
         // Don't show bip49 if it's selected but network doesn't support it
         if (bip49TabSelected() && !networkHasBip49()) {
             return;
             displayBip49Info();
         }
         displayBip32Info();
-        hidePending();
     }
 
     function generateClicked() {
                 for (var i=0; i<rows.length; i++) {
                     rows[i].shouldGenerate = false;
                 }
+                hidePending();
             }
 
             for (var i=0; i<total; i++) {
                 var index = i + start;
-                rows.push(new TableRow(index));
+                var isLast = i == total - 1;
+                rows.push(new TableRow(index, isLast));
             }
 
         })());
     }
 
-    function TableRow(index) {
+    function TableRow(index, isLast) {
 
         var self = this;
         this.shouldGenerate = true;
                     address = bitcoinjs.bitcoin.address.fromOutputScript(scriptpubkey, network)
                 }
                 addAddressToList(indexText, address, pubkey, privkey);
+                if (isLast) {
+                    hidePending();
+                }
             }, 50)
         }
 
index dea908bec26429fc562986683e2a45685b91bdd3..464a15dde87c535bce9b061aaf82419a07ae1062 100644 (file)
--- a/tests.js
+++ b/tests.js
@@ -4120,6 +4120,41 @@ page.open(url, function(status) {
 });
 },
 
+// github issue 43
+// Cleared mnemonic and root key still allows addresses to be generated
+// https://github.com/iancoleman/bip39/issues/43
+function() {
+page.open(url, function(status) {
+    // set the phrase
+    page.evaluate(function() {
+        $("#bip49-tab a").click();
+        $(".phrase").val("abandon abandon ability");
+        $(".phrase").trigger("input");
+    });
+    waitForGenerate(function() {
+        // clear the mnemonic and root key
+        page.evaluate(function() {
+            $(".phrase").val("");
+            $(".phrase").trigger("input");
+            $(".root-key").val("");
+            $(".root-key").trigger("input");
+            $(".more").click();
+        });
+        waitForFeedback(function() {
+            // check there are no addresses shown
+            var addressCount = page.evaluate(function() {
+                return $(".address").length;
+            });
+            if (addressCount != 0) {
+                console.log("Clearing mnemonic should not allow addresses to be generated");
+                fail();
+            }
+            next();
+        });
+    });
+});
+},
+
 // If you wish to add more tests, do so here...
 
 // Here is a blank test template