diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/index.html | 7 | ||||
-rw-r--r-- | src/js/index.js | 15 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/index.html b/src/index.html index fcdf109..25e30fc 100644 --- a/src/index.html +++ b/src/index.html | |||
@@ -187,6 +187,13 @@ | |||
187 | </div> | 187 | </div> |
188 | </div> | 188 | </div> |
189 | <div class="form-group"> | 189 | <div class="form-group"> |
190 | <div class="col-sm-2"></div> | ||
191 | <label class="col-sm-10"> | ||
192 | <input class="hardened-addresses" type="checkbox"> | ||
193 | Use hardened addresses | ||
194 | </label> | ||
195 | </div> | ||
196 | <div class="form-group"> | ||
190 | <label class="col-sm-2 control-label">Hive Wallet</label> | 197 | <label class="col-sm-2 control-label">Hive Wallet</label> |
191 | <div class="col-sm-10"> | 198 | <div class="col-sm-10"> |
192 | <p class="form-control no-border"> | 199 | <p class="form-control no-border"> |
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 | } |