From 1975bfbc2be03063046b24cb599c119675264186 Mon Sep 17 00:00:00 2001 From: Ian Coleman Date: Tue, 23 Aug 2016 15:00:19 +1000 Subject: [PATCH] Standalone has hardened addresses checkbox --- bip39-standalone.html | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/bip39-standalone.html b/bip39-standalone.html index 9d0de5e..5230003 100644 --- a/bip39-standalone.html +++ b/bip39-standalone.html @@ -190,6 +190,13 @@ +
+
+ +
@@ -208,6 +215,15 @@

+
+ +
+

+ Use path m/0'/0' with hardened addresses. + For more info see the Bitcoin Core BIP32 implementation +

+
+
@@ -14853,6 +14869,7 @@ var Mnemonic = function(language) { DOM.bip44account = $("#bip44 .account"); DOM.bip44change = $("#bip44 .change"); DOM.strength = $(".strength"); + DOM.hardenedAddresses = $(".hardened-addresses"); DOM.addresses = $(".addresses"); DOM.rowsToAdd = $(".rows-to-add"); DOM.more = $(".more"); @@ -14876,6 +14893,7 @@ var Mnemonic = function(language) { DOM.bip44account.on("input", calcForDerivationPath); DOM.bip44change.on("input", calcForDerivationPath); DOM.tab.on("shown.bs.tab", calcForDerivationPath); + DOM.hardenedAddresses.on("change", calcForDerivationPath); DOM.indexToggle.on("click", toggleIndexes); DOM.addressToggle.on("click", toggleAddresses); DOM.privateKeyToggle.on("click", togglePrivateKeys); @@ -15180,16 +15198,27 @@ var Mnemonic = function(language) { function TableRow(index) { + var useHardenedAddresses = DOM.hardenedAddresses.prop("checked"); + function init() { calculateValues(); } function calculateValues() { setTimeout(function() { - var key = bip32ExtendedKey.derive(index); + var key = ""; + if (useHardenedAddresses) { + key = bip32ExtendedKey.deriveHardened(index); + } + else { + key = bip32ExtendedKey.derive(index); + } var address = key.getAddress().toString(); var privkey = key.privKey.toWIF(network); var indexText = getDerivationPath() + "/" + index; + if (useHardenedAddresses) { + indexText = indexText + "'"; + } addAddressToList(indexText, address, privkey); }, 50) } -- 2.41.0