]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/commitdiff
Regression test for seed from Japanese mnemonic
authorIan Coleman <coleman.ian@gmail.com>
Thu, 2 Mar 2017 21:30:06 +0000 (08:30 +1100)
committerIan Coleman <coleman.ian@gmail.com>
Thu, 2 Mar 2017 21:30:06 +0000 (08:30 +1100)
tests.js

index 6d14b488ed121e2a7fdbd097abd1b62abda1e8be..d55b8f4730379bb34a9591362939427a282266ce 100644 (file)
--- a/tests.js
+++ b/tests.js
@@ -3582,6 +3582,35 @@ page.open(url, function(status) {
 });
 },
 
+
+// github issue 60
+// Japanese mnemonics generate incorrect bip32 seed
+// BIP39 seed is set from phrase
+function() {
+page.open(url, function(status) {
+    // set the phrase
+    var expected = "a262d6fb6122ecf45be09c50492b31f92e9beb7d9a845987a02cefda57a15f9c467a17872029a9e92299b5cbdf306e3a0ee620245cbd508959b6cb7ca637bd55";
+    page.evaluate(function() {
+        $(".phrase").val("あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あおぞら");
+        $("#passphrase").val("メートルガバヴァぱばぐゞちぢ十人十色");
+        $("#passphrase").trigger("input");
+    });
+    // check the seed is generated correctly
+    waitForGenerate(function() {
+        var actual = page.evaluate(function() {
+            return $(".seed").val();
+        });
+        if (actual != expected) {
+            console.log("BIP39 seed is incorrectly generated from Japanese mnemonic");
+            console.log("Expected: " + expected);
+            console.log("Actual: " + actual);
+            fail();
+        }
+        next();
+    });
+});
+},
+
 // If you wish to add more tests, do so here...
 
 // Here is a blank test template