diff options
Diffstat (limited to 'src/js/index.js')
-rw-r--r-- | src/js/index.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/js/index.js b/src/js/index.js index 88e891c..68f1cda 100644 --- a/src/js/index.js +++ b/src/js/index.js | |||
@@ -35,6 +35,7 @@ | |||
35 | DOM.bip44account = $("#bip44 .account"); | 35 | DOM.bip44account = $("#bip44 .account"); |
36 | DOM.bip44change = $("#bip44 .change"); | 36 | DOM.bip44change = $("#bip44 .change"); |
37 | DOM.strength = $(".strength"); | 37 | DOM.strength = $(".strength"); |
38 | DOM.hardenedAddresses = $(".hardened-addresses"); | ||
38 | DOM.addresses = $(".addresses"); | 39 | DOM.addresses = $(".addresses"); |
39 | DOM.rowsToAdd = $(".rows-to-add"); | 40 | DOM.rowsToAdd = $(".rows-to-add"); |
40 | DOM.more = $(".more"); | 41 | DOM.more = $(".more"); |
@@ -58,6 +59,7 @@ | |||
58 | DOM.bip44account.on("input", calcForDerivationPath); | 59 | DOM.bip44account.on("input", calcForDerivationPath); |
59 | DOM.bip44change.on("input", calcForDerivationPath); | 60 | DOM.bip44change.on("input", calcForDerivationPath); |
60 | DOM.tab.on("shown.bs.tab", calcForDerivationPath); | 61 | DOM.tab.on("shown.bs.tab", calcForDerivationPath); |
62 | DOM.hardenedAddresses.on("change", calcForDerivationPath); | ||
61 | DOM.indexToggle.on("click", toggleIndexes); | 63 | DOM.indexToggle.on("click", toggleIndexes); |
62 | DOM.addressToggle.on("click", toggleAddresses); | 64 | DOM.addressToggle.on("click", toggleAddresses); |
63 | DOM.privateKeyToggle.on("click", togglePrivateKeys); | 65 | DOM.privateKeyToggle.on("click", togglePrivateKeys); |
@@ -362,16 +364,27 @@ | |||
362 | 364 | ||
363 | function TableRow(index) { | 365 | function TableRow(index) { |
364 | 366 | ||
367 | var useHardenedAddresses = DOM.hardenedAddresses.prop("checked"); | ||
368 | |||
365 | function init() { | 369 | function init() { |
366 | calculateValues(); | 370 | calculateValues(); |
367 | } | 371 | } |
368 | 372 | ||
369 | function calculateValues() { | 373 | function calculateValues() { |
370 | setTimeout(function() { | 374 | setTimeout(function() { |
371 | var key = bip32ExtendedKey.derive(index); | 375 | var key = ""; |
376 | if (useHardenedAddresses) { | ||
377 | key = bip32ExtendedKey.deriveHardened(index); | ||
378 | } | ||
379 | else { | ||
380 | key = bip32ExtendedKey.derive(index); | ||
381 | } | ||
372 | var address = key.getAddress().toString(); | 382 | var address = key.getAddress().toString(); |
373 | var privkey = key.privKey.toWIF(network); | 383 | var privkey = key.privKey.toWIF(network); |
374 | var indexText = getDerivationPath() + "/" + index; | 384 | var indexText = getDerivationPath() + "/" + index; |
385 | if (useHardenedAddresses) { | ||
386 | indexText = indexText + "'"; | ||
387 | } | ||
375 | addAddressToList(indexText, address, privkey); | 388 | addAddressToList(indexText, address, privkey); |
376 | }, 50) | 389 | }, 50) |
377 | } | 390 | } |