aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/js/index.js2
-rw-r--r--src/js/jsbip39.js6
-rw-r--r--tests/spec/tests.js9
3 files changed, 14 insertions, 3 deletions
diff --git a/src/js/index.js b/src/js/index.js
index 472d392..8caa0ed 100644
--- a/src/js/index.js
+++ b/src/js/index.js
@@ -240,7 +240,7 @@
240 } 240 }
241 phraseChangeTimeoutEvent = setTimeout(function() { 241 phraseChangeTimeoutEvent = setTimeout(function() {
242 phraseChanged(); 242 phraseChanged();
243 var entropy = mnemonic.toRawEntropyHex(DOM.phrase.val()); 243 var entropy = mnemonic.toRawEntropyBin(DOM.phrase.val());
244 if (entropy !== null) { 244 if (entropy !== null) {
245 DOM.entropyMnemonicLength.val("raw"); 245 DOM.entropyMnemonicLength.val("raw");
246 DOM.entropy.val(entropy); 246 DOM.entropy.val(entropy);
diff --git a/src/js/jsbip39.js b/src/js/jsbip39.js
index 9a6e7ec..1e52d9d 100644
--- a/src/js/jsbip39.js
+++ b/src/js/jsbip39.js
@@ -130,6 +130,12 @@ var Mnemonic = function(language) {
130 return h; 130 return h;
131 } 131 }
132 132
133 self.toRawEntropyBin = function(mnemonic) {
134 var b = mnemonicToBinaryString(mnemonic);
135 var d = b.substring(0, b.length / 33 * 32);
136 return d;
137 }
138
133 self.toSeed = function(mnemonic, passphrase) { 139 self.toSeed = function(mnemonic, passphrase) {
134 passphrase = passphrase || ''; 140 passphrase = passphrase || '';
135 mnemonic = self.joinWords(self.splitWords(mnemonic)); // removes duplicate blanks 141 mnemonic = self.joinWords(self.splitWords(mnemonic)); // removes duplicate blanks
diff --git a/tests/spec/tests.js b/tests/spec/tests.js
index 977294c..07918c2 100644
--- a/tests/spec/tests.js
+++ b/tests/spec/tests.js
@@ -4129,8 +4129,13 @@ fit('Converts mnemonics into raw entropy', function(done) {
4129 driver.findElement(By.css('.entropy')) 4129 driver.findElement(By.css('.entropy'))
4130 .getAttribute("value") 4130 .getAttribute("value")
4131 .then(function(entropy) { 4131 .then(function(entropy) {
4132 expect(entropy).toBe("00000001"); 4132 expect(entropy).toBe("00000000000000000000000000000001");
4133 done(); 4133 driver.findElement(By.css('.phrase'))
4134 .getAttribute("value")
4135 .then(function(phrase) {
4136 expect(phrase).toBe("abandon abandon about");
4137 done();
4138 });
4134 }); 4139 });
4135 }); 4140 });
4136}); 4141});