diff options
author | Ian Coleman <coleman.ian@gmail.com> | 2016-12-12 10:54:08 +1100 |
---|---|---|
committer | Ian Coleman <coleman.ian@gmail.com> | 2016-12-12 11:04:41 +1100 |
commit | c554e6ff5c2c543997841c0fb0a506262843e8df (patch) | |
tree | 25641801120c7e80b6c76c28aea86a12cb8cf148 /src/js | |
parent | 32fab2c39507357909438c2be8cd100c6539038f (diff) | |
download | BIP39-c554e6ff5c2c543997841c0fb0a506262843e8df.tar.gz BIP39-c554e6ff5c2c543997841c0fb0a506262843e8df.tar.zst BIP39-c554e6ff5c2c543997841c0fb0a506262843e8df.zip |
BIP44 Account xprv and xpub keys are shown
which are used for import / export in most BIP44 wallets.
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/index.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/js/index.js b/src/js/index.js index 6367c01..748a2ba 100644 --- a/src/js/index.js +++ b/src/js/index.js | |||
@@ -51,6 +51,8 @@ | |||
51 | DOM.bip44purpose = $("#bip44 .purpose"); | 51 | DOM.bip44purpose = $("#bip44 .purpose"); |
52 | DOM.bip44coin = $("#bip44 .coin"); | 52 | DOM.bip44coin = $("#bip44 .coin"); |
53 | DOM.bip44account = $("#bip44 .account"); | 53 | DOM.bip44account = $("#bip44 .account"); |
54 | DOM.bip44accountXprv = $("#bip44 .account-xprv"); | ||
55 | DOM.bip44accountXpub = $("#bip44 .account-xpub"); | ||
54 | DOM.bip44change = $("#bip44 .change"); | 56 | DOM.bip44change = $("#bip44 .change"); |
55 | DOM.generatedStrength = $(".generate-container .strength"); | 57 | DOM.generatedStrength = $(".generate-container .strength"); |
56 | DOM.hardenedAddresses = $(".hardened-addresses"); | 58 | DOM.hardenedAddresses = $(".hardened-addresses"); |
@@ -239,6 +241,9 @@ | |||
239 | return; | 241 | return; |
240 | } | 242 | } |
241 | bip32ExtendedKey = calcBip32ExtendedKey(derivationPath); | 243 | bip32ExtendedKey = calcBip32ExtendedKey(derivationPath); |
244 | if (bip44TabSelected()) { | ||
245 | displayBip44Info(); | ||
246 | } | ||
242 | displayBip32Info(); | 247 | displayBip32Info(); |
243 | hidePending(); | 248 | hidePending(); |
244 | } | 249 | } |
@@ -450,6 +455,24 @@ | |||
450 | return false; | 455 | return false; |
451 | } | 456 | } |
452 | 457 | ||
458 | function displayBip44Info() { | ||
459 | // Get the derivation path for the account | ||
460 | var purpose = parseIntNoNaN(DOM.bip44purpose.val(), 44); | ||
461 | var coin = parseIntNoNaN(DOM.bip44coin.val(), 0); | ||
462 | var account = parseIntNoNaN(DOM.bip44account.val(), 0); | ||
463 | var path = "m/"; | ||
464 | path += purpose + "'/"; | ||
465 | path += coin + "'/"; | ||
466 | path += account + "'/"; | ||
467 | // Calculate the account extended keys | ||
468 | var accountExtendedKey = calcBip32ExtendedKey(path); | ||
469 | var accountXprv = accountExtendedKey.toBase58(); | ||
470 | var accountXpub = accountExtendedKey.toBase58(false); | ||
471 | // Display the extended keys | ||
472 | DOM.bip44accountXprv.val(accountXprv); | ||
473 | DOM.bip44accountXpub.val(accountXpub); | ||
474 | } | ||
475 | |||
453 | function displayBip32Info() { | 476 | function displayBip32Info() { |
454 | // Display the key | 477 | // Display the key |
455 | DOM.seed.val(seed); | 478 | DOM.seed.val(seed); |