aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Coleman <ian@iancoleman.io>2019-12-18 09:07:17 +1100
committerIan Coleman <ian@iancoleman.io>2019-12-18 09:07:17 +1100
commit244c76022af53c1f5b337a5a2cdb70358cf85e19 (patch)
tree160e7ac0b4235b81c4ffb237af0ce15971f466b6
parent516c16d721db88b4b2c39964e2d5e8f6310c7bff (diff)
downloadBIP39-244c76022af53c1f5b337a5a2cdb70358cf85e19.tar.gz
BIP39-244c76022af53c1f5b337a5a2cdb70358cf85e19.tar.zst
BIP39-244c76022af53c1f5b337a5a2cdb70358cf85e19.zip
Convert mnemonic to hex entropy instead of binary
-rw-r--r--src/js/index.js4
-rw-r--r--tests/spec/tests.js2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/js/index.js b/src/js/index.js
index 3db0a31..c9e7b44 100644
--- a/src/js/index.js
+++ b/src/js/index.js
@@ -239,10 +239,12 @@
239 } 239 }
240 phraseChangeTimeoutEvent = setTimeout(function() { 240 phraseChangeTimeoutEvent = setTimeout(function() {
241 phraseChanged(); 241 phraseChanged();
242 var entropy = mnemonic.toRawEntropyBin(DOM.phrase.val()); 242 var entropy = mnemonic.toRawEntropyHex(DOM.phrase.val());
243 if (entropy !== null) { 243 if (entropy !== null) {
244 DOM.entropyMnemonicLength.val("raw"); 244 DOM.entropyMnemonicLength.val("raw");
245 DOM.entropy.val(entropy); 245 DOM.entropy.val(entropy);
246 DOM.entropyTypeInputs.filter("[value='hexadecimal']").prop("checked", true);
247 entropyTypeAutoDetect = false;
246 } 248 }
247 }, 400); 249 }, 400);
248 } 250 }
diff --git a/tests/spec/tests.js b/tests/spec/tests.js
index bdc5909..fefb8b7 100644
--- a/tests/spec/tests.js
+++ b/tests/spec/tests.js
@@ -4243,7 +4243,7 @@ it('Converts mnemonics into raw entropy', function(done) {
4243 driver.findElement(By.css('.entropy')) 4243 driver.findElement(By.css('.entropy'))
4244 .getAttribute("value") 4244 .getAttribute("value")
4245 .then(function(entropy) { 4245 .then(function(entropy) {
4246 expect(entropy).toBe("00000000000000000000000000000001"); 4246 expect(entropy).toBe("00000001");
4247 driver.findElement(By.css('.phrase')) 4247 driver.findElement(By.css('.phrase'))
4248 .getAttribute("value") 4248 .getAttribute("value")
4249 .then(function(phrase) { 4249 .then(function(phrase) {