Commit 2728021b authored by kenshin-samourai's avatar kenshin-samourai
Browse files

display private keys in wif format

parent c1dc1be2
......@@ -70,7 +70,7 @@
</td>
</tr>
<tr>
<th>BIP47 NOTIFICATION PUBLIC KEY</th>
<th>BIP47 NOTIFICATION PUBLIC KEY (HEX)</th>
<td>
<div id="alice_notif_pubkey" class="result"></div>
</td>
......@@ -79,7 +79,7 @@
</td>
</tr>
<tr>
<th>BIP47 NOTIFICATION PRIVATE KEY</th>
<th>BIP47 NOTIFICATION PRIVATE KEY (WIF)</th>
<td>
<div id="alice_notif_privkey" class="result"></div>
</td>
......
function derivePaymentAddresses(pcode, key, idx, network, getPrivKey) {
const pmt_pubkey = pcode.derivePaymentPublicKey(key, idx)
const pmt_privkey = getPrivKey ? pcode.derivePaymentPrivateKey(key, idx).toString('hex') : ''
const pmt_privkey = getPrivKey
? bitcoinjs.ECPair.fromPrivateKey(pcode.derivePaymentPrivateKey(key, idx)).toWIF()
: ''
const p2pkh = bitcoinjs.payments.p2pkh({
pubkey: pmt_pubkey,
......@@ -146,8 +149,8 @@ function refresh() {
addr_list += `P2PKH<br/>`
addr_list += `P2WPKH<br/>`
addr_list += `P2WPKH/P2SH<br/>`
addr_list += `Public Key<br/>`
addr_list += `Private Key<br/>`
addr_list += `Public Key (hex format)<br/>`
addr_list += `Private Key (WIF format)<br/>`
addr_list += `<br/>`
a_addr_list += `<b>BIP47 PAYMENT ADDRESS #${idx}</b><br/>`
......@@ -167,10 +170,11 @@ function refresh() {
}
if (hasValidMnemonic) {
const a_notif_privkey_wif = bitcoinjs.ECPair.fromPrivateKey(a_notif_privkey).toWIF()
$('#alice_paymentcode').html(a_pcode.toBase58())
$('#alice_notif_addr').text(a_notif_addr)
$('#alice_notif_pubkey').text(a_notif_pubkey.toString('hex'))
$('#alice_notif_privkey').text(a_notif_privkey.toString('hex'))
$('#alice_notif_privkey').text(a_notif_privkey_wif)
}
if (hasValidPaymentCode) {
$('#bob_notif_addr').text(b_notif_addr)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment