diff options
author | Ian Coleman <coleman.ian@gmail.com> | 2016-11-25 14:56:09 +1100 |
---|---|---|
committer | Ian Coleman <coleman.ian@gmail.com> | 2016-11-25 14:56:09 +1100 |
commit | 92e73fd952dd89069c51b47689ab39b28f99a547 (patch) | |
tree | 26b9ab5a7474d88f1342bee1c42dbf3c634837a9 | |
parent | 78b8d6048ab7fc56d2a2b389545f8314ad83e387 (diff) | |
download | BIP39-92e73fd952dd89069c51b47689ab39b28f99a547.tar.gz BIP39-92e73fd952dd89069c51b47689ab39b28f99a547.tar.zst BIP39-92e73fd952dd89069c51b47689ab39b28f99a547.zip |
Test for issue 33 checks raw entropy is in use
-rw-r--r-- | tests.js | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -3089,6 +3089,7 @@ page.open(url, function(status) { | |||
3089 | // use entropy | 3089 | // use entropy |
3090 | page.evaluate(function() { | 3090 | page.evaluate(function() { |
3091 | $(".use-entropy").prop("checked", true).trigger("change"); | 3091 | $(".use-entropy").prop("checked", true).trigger("change"); |
3092 | $(".mnemonic-length").val("raw"); | ||
3092 | $(".entropy").val("7S 9H 9S QH 8C KS AS 7D 7C QD 4S 4D TC 2D 5S JS 3D 8S 8H 4C 3C AC 3S QC 9C JC 7H AD TD JD 6D KH 5C QS 2S 6S 6H JH KD 9D-6C TS TH 4H KC 5H 2H AH 2C 8D 3H 5D").trigger("input"); | 3093 | $(".entropy").val("7S 9H 9S QH 8C KS AS 7D 7C QD 4S 4D TC 2D 5S JS 3D 8S 8H 4C 3C AC 3S QC 9C JC 7H AD TD JD 6D KH 5C QS 2S 6S 6H JH KD 9D-6C TS TH 4H KC 5H 2H AH 2C 8D 3H 5D").trigger("input"); |
3093 | }); | 3094 | }); |
3094 | // get the mnemonic | 3095 | // get the mnemonic |
@@ -3106,6 +3107,19 @@ page.open(url, function(status) { | |||
3106 | var newPhrase = page.evaluate(function() { | 3107 | var newPhrase = page.evaluate(function() { |
3107 | return $(".phrase").val(); | 3108 | return $(".phrase").val(); |
3108 | }); | 3109 | }); |
3110 | // check raw entropy is in use, ie the first bits should remain the same | ||
3111 | var startLength = 20; | ||
3112 | var originalPhraseStart = originalPhrase.substring(0,startLength); | ||
3113 | var newPhraseStart = newPhrase.substring(0,startLength); | ||
3114 | if (newPhraseStart != originalPhraseStart) { | ||
3115 | console.log("Changing last 12 cards changed first portion of mnemonic"); | ||
3116 | console.log("Original:"); | ||
3117 | console.log(originalPhrase); | ||
3118 | console.log("New:"); | ||
3119 | console.log(newPhrase); | ||
3120 | fail(); | ||
3121 | } | ||
3122 | // check the phrase has changed | ||
3109 | if (newPhrase == originalPhrase) { | 3123 | if (newPhrase == originalPhrase) { |
3110 | console.log("Changing last 12 cards does not change mnemonic"); | 3124 | console.log("Changing last 12 cards does not change mnemonic"); |
3111 | console.log("Original:"); | 3125 | console.log("Original:"); |