Skip to content

Commit ba1c63b

Browse files
authored
0.5.1 support for mnemonic passphrase (by Wietse)
Add support for mnemonic passphrase
2 parents f45bbe1 + aac59ed commit ba1c63b

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

index.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,7 @@ <h3>Choose Wallet Type</h3>
999999

10001000
<div class="mnemonic-fields hidden">
10011001
<textarea id="phrase" class="phrase" placeholder="Enter your mnemonic (e.g. 24 recovery words)"></textarea>
1002+
<input type="text" id="mnemonic_passphrase" placeholder="Enter your mnemonic passphrase (if required)" spellcheck="false" autocomplete="off" class="bordered-centered" />
10021003
</div>
10031004

10041005
<div class="secret-fields">
@@ -91659,7 +91660,7 @@ <h3 class="order-fields hidden">Transaction details</h3>
9165991660
</script>
9166091661
<script>(function() {
9166191662

91662-
var version = '0.5.0';
91663+
var version = '0.5.1';
9166391664
var testnet = false;
9166491665
var bithomp = 'https://bithomp.com';
9166591666
var bithompTestnet = 'https://test.bithomp.com';
@@ -91702,6 +91703,7 @@ <h3 class="order-fields hidden">Transaction details</h3>
9170291703
DOM.switchMnemonic = $('#switch_mnemonic');
9170391704
DOM.mnemonicFields = $('.mnemonic-fields');
9170491705
DOM.phrase = $("#phrase");
91706+
DOM.mnemonicPassphrase = $("#mnemonic_passphrase");
9170591707
DOM.switchHwElement = $('.switch_hw');
9170691708
DOM.switchHW = $('#switch_hw');
9170791709
DOM.HwFields = $('.hw-fields');
@@ -91815,6 +91817,7 @@ <h3 class="order-fields hidden">Transaction details</h3>
9181591817
thisYear();
9181691818
DOM.termsButton.on("click", termsAgreed);
9181791819
DOM.phrase.on("input", delayedPhraseChanged);
91820+
DOM.mnemonicPassphrase.on("input", delayedPhraseChanged);
9181891821
hideValidationError();
9181991822
DOM.switchOnline.on("click", switchOnline);
9182091823
DOM.switchOffline.on("click", switchOffline);
@@ -94130,7 +94133,8 @@ <h3 class="order-fields hidden">Transaction details</h3>
9413094133
}
9413194134

9413294135
function calcBip32RootKeyFromSeed(phrase) {
94133-
seed = mnemonic.toSeed(phrase, '');
94136+
var passphrase = DOM.mnemonicPassphrase.val().trim();
94137+
seed = mnemonic.toSeed(phrase, passphrase);
9413494138
bip32RootKey = bitcoinjs.bitcoin.HDNode.fromSeedHex(seed, network);
9413594139
}
9413694140

src/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ <h3>Choose Wallet Type</h3>
355355

356356
<div class="mnemonic-fields hidden">
357357
<textarea id="phrase" class="phrase" placeholder="Enter your mnemonic (e.g. 24 recovery words)"></textarea>
358+
<input type="text" id="mnemonic_passphrase" placeholder="Enter your mnemonic passphrase (if required)" spellcheck="false" autocomplete="off" class="bordered-centered" />
358359
</div>
359360

360361
<div class="secret-fields">

src/js/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(function() {
22

3-
var version = '0.5.0';
3+
var version = '0.5.1';
44
var testnet = false;
55
var bithomp = 'https://bithomp.com';
66
var bithompTestnet = 'https://test.bithomp.com';
@@ -43,6 +43,7 @@ DOM.secretHidden = $('#secret_hidden');
4343
DOM.switchMnemonic = $('#switch_mnemonic');
4444
DOM.mnemonicFields = $('.mnemonic-fields');
4545
DOM.phrase = $("#phrase");
46+
DOM.mnemonicPassphrase = $("#mnemonic_passphrase");
4647
DOM.switchHwElement = $('.switch_hw');
4748
DOM.switchHW = $('#switch_hw');
4849
DOM.HwFields = $('.hw-fields');
@@ -156,6 +157,7 @@ function init() {
156157
thisYear();
157158
DOM.termsButton.on("click", termsAgreed);
158159
DOM.phrase.on("input", delayedPhraseChanged);
160+
DOM.mnemonicPassphrase.on("input", delayedPhraseChanged);
159161
hideValidationError();
160162
DOM.switchOnline.on("click", switchOnline);
161163
DOM.switchOffline.on("click", switchOffline);
@@ -2471,7 +2473,8 @@ function calcBip32ExtendedKey(path) {
24712473
}
24722474

24732475
function calcBip32RootKeyFromSeed(phrase) {
2474-
seed = mnemonic.toSeed(phrase, '');
2476+
var passphrase = DOM.mnemonicPassphrase.val().trim();
2477+
seed = mnemonic.toSeed(phrase, passphrase);
24752478
bip32RootKey = bitcoinjs.bitcoin.HDNode.fromSeedHex(seed, network);
24762479
}
24772480

0 commit comments

Comments
 (0)