aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/index.html2
-rw-r--r--src/js/index.js42
2 files changed, 43 insertions, 1 deletions
diff --git a/src/index.html b/src/index.html
index fe048dc..e8aac4d 100644
--- a/src/index.html
+++ b/src/index.html
@@ -221,7 +221,7 @@
221 <div class="form-group"> 221 <div class="form-group">
222 <label for="seed" class="col-sm-2 control-label">BIP39 Seed</label> 222 <label for="seed" class="col-sm-2 control-label">BIP39 Seed</label>
223 <div class="col-sm-10"> 223 <div class="col-sm-10">
224 <textarea id="seed" class="seed private-data form-control" readonly="readonly" data-show-qr autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea> 224 <textarea id="seed" class="seed private-data form-control" data-show-qr autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>
225 </div> 225 </div>
226 </div> 226 </div>
227 <div class="form-group"> 227 <div class="form-group">
diff --git a/src/js/index.js b/src/js/index.js
index d169ed2..3148ca4 100644
--- a/src/js/index.js
+++ b/src/js/index.js
@@ -19,6 +19,7 @@
19 var entropyTypeAutoDetect = true; 19 var entropyTypeAutoDetect = true;
20 var entropyChangeTimeoutEvent = null; 20 var entropyChangeTimeoutEvent = null;
21 var phraseChangeTimeoutEvent = null; 21 var phraseChangeTimeoutEvent = null;
22 var seedChangedTimeoutEvent = null;
22 var rootKeyChangedTimeoutEvent = null; 23 var rootKeyChangedTimeoutEvent = null;
23 24
24 var generationProcesses = []; 25 var generationProcesses = [];
@@ -135,6 +136,7 @@
135 DOM.passphrase.on("input", delayedPhraseChanged); 136 DOM.passphrase.on("input", delayedPhraseChanged);
136 DOM.generate.on("click", generateClicked); 137 DOM.generate.on("click", generateClicked);
137 DOM.more.on("click", showMore); 138 DOM.more.on("click", showMore);
139 DOM.seed.on("input", delayedSeedChanged);
138 DOM.rootKey.on("input", delayedRootKeyChanged); 140 DOM.rootKey.on("input", delayedRootKeyChanged);
139 DOM.litecoinUseLtub.on("change", litecoinUseLtubChanged); 141 DOM.litecoinUseLtub.on("change", litecoinUseLtubChanged);
140 DOM.bip32path.on("input", calcForDerivationPath); 142 DOM.bip32path.on("input", calcForDerivationPath);
@@ -340,6 +342,30 @@
340 entropyChanged(); 342 entropyChanged();
341 } 343 }
342 344
345 function delayedSeedChanged() {
346 // Warn if there is an existing mnemonic or passphrase.
347 if (DOM.phrase.val().length > 0 || DOM.passphrase.val().length > 0) {
348 if (!confirm("This will clear existing mnemonic and passphrase")) {
349 DOM.seed.val(seed);
350 return
351 }
352 }
353 hideValidationError();
354 showPending();
355 // Clear existing mnemonic and passphrase
356 DOM.phrase.val("");
357 DOM.phraseSplit.val("");
358 DOM.passphrase.val("");
359 DOM.rootKey.val("");
360 clearAddressesList();
361 clearDerivedKeys();
362 seed = null;
363 if (seedChangedTimeoutEvent != null) {
364 clearTimeout(seedChangedTimeoutEvent);
365 }
366 seedChangedTimeoutEvent = setTimeout(seedChanged, 400);
367 }
368
343 function delayedRootKeyChanged() { 369 function delayedRootKeyChanged() {
344 // Warn if there is an existing mnemonic or passphrase. 370 // Warn if there is an existing mnemonic or passphrase.
345 if (DOM.phrase.val().length > 0 || DOM.passphrase.val().length > 0) { 371 if (DOM.phrase.val().length > 0 || DOM.passphrase.val().length > 0) {
@@ -361,6 +387,22 @@
361 rootKeyChangedTimeoutEvent = setTimeout(rootKeyChanged, 400); 387 rootKeyChangedTimeoutEvent = setTimeout(rootKeyChanged, 400);
362 } 388 }
363 389
390 function seedChanged() {
391 showPending();
392 hideValidationError();
393 seed = DOM.seed.val();
394 bip32RootKey = bitcoinjs.bitcoin.HDNode.fromSeedHex(seed, network);
395 var rootKeyBase58 = bip32RootKey.toBase58();
396 DOM.rootKey.val(rootKeyBase58);
397 var errorText = validateRootKey(rootKeyBase58);
398 if (errorText) {
399 showValidationError(errorText);
400 return;
401 }
402 // Calculate and display
403 calcForDerivationPath();
404 }
405
364 function rootKeyChanged() { 406 function rootKeyChanged() {
365 showPending(); 407 showPending();
366 hideValidationError(); 408 hideValidationError();