aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Coleman <coleman.ian@gmail.com>2016-11-02 12:13:21 +1100
committerIan Coleman <coleman.ian@gmail.com>2016-11-02 12:13:21 +1100
commit1b12b2f5f12b32a2ed6e69ff77f10b889b383e97 (patch)
treece1804c806661b34ec4354db35cf1fd290a5fcb2 /src
parent92b46ab44fb7fe7aef1cef3d843d1e3d19c1d7cb (diff)
downloadBIP39-1b12b2f5f12b32a2ed6e69ff77f10b889b383e97.tar.gz
BIP39-1b12b2f5f12b32a2ed6e69ff77f10b889b383e97.tar.zst
BIP39-1b12b2f5f12b32a2ed6e69ff77f10b889b383e97.zip
Public key column in table, shown as hex
Diffstat (limited to 'src')
-rw-r--r--src/index.html7
-rw-r--r--src/js/index.js18
2 files changed, 23 insertions, 2 deletions
diff --git a/src/index.html b/src/index.html
index b24b4d4..5832a9b 100644
--- a/src/index.html
+++ b/src/index.html
@@ -296,6 +296,12 @@
296 </th> 296 </th>
297 <th> 297 <th>
298 <div class="input-group"> 298 <div class="input-group">
299 Public Key&nbsp;&nbsp;
300 <button class="public-key-toggle">Toggle</button>
301 </div>
302 </th>
303 <th>
304 <div class="input-group">
299 Private Key&nbsp;&nbsp; 305 Private Key&nbsp;&nbsp;
300 <button class="private-key-toggle">Toggle</button> 306 <button class="private-key-toggle">Toggle</button>
301 </div> 307 </div>
@@ -438,6 +444,7 @@
438 <tr> 444 <tr>
439 <td class="index"><span></span></td> 445 <td class="index"><span></span></td>
440 <td class="address"><span></span></td> 446 <td class="address"><span></span></td>
447 <td class="pubkey"><span></span></td>
441 <td class="privkey"><span></span></td> 448 <td class="privkey"><span></span></td>
442 </tr> 449 </tr>
443 </script> 450 </script>
diff --git a/src/js/index.js b/src/js/index.js
index c5f6c11..0e4cc05 100644
--- a/src/js/index.js
+++ b/src/js/index.js
@@ -11,6 +11,7 @@
11 11
12 var showIndex = true; 12 var showIndex = true;
13 var showAddress = true; 13 var showAddress = true;
14 var showPubKey = true;
14 var showPrivKey = true; 15 var showPrivKey = true;
15 16
16 var phraseChangeTimeoutEvent = null; 17 var phraseChangeTimeoutEvent = null;
@@ -45,6 +46,7 @@
45 DOM.tab = $(".derivation-type a"); 46 DOM.tab = $(".derivation-type a");
46 DOM.indexToggle = $(".index-toggle"); 47 DOM.indexToggle = $(".index-toggle");
47 DOM.addressToggle = $(".address-toggle"); 48 DOM.addressToggle = $(".address-toggle");
49 DOM.publicKeyToggle = $(".public-key-toggle");
48 DOM.privateKeyToggle = $(".private-key-toggle"); 50 DOM.privateKeyToggle = $(".private-key-toggle");
49 DOM.languages = $(".languages a"); 51 DOM.languages = $(".languages a");
50 52
@@ -65,6 +67,7 @@
65 DOM.hardenedAddresses.on("change", calcForDerivationPath); 67 DOM.hardenedAddresses.on("change", calcForDerivationPath);
66 DOM.indexToggle.on("click", toggleIndexes); 68 DOM.indexToggle.on("click", toggleIndexes);
67 DOM.addressToggle.on("click", toggleAddresses); 69 DOM.addressToggle.on("click", toggleAddresses);
70 DOM.publicKeyToggle.on("click", togglePublicKeys);
68 DOM.privateKeyToggle.on("click", togglePrivateKeys); 71 DOM.privateKeyToggle.on("click", togglePrivateKeys);
69 DOM.languages.on("click", languageChanged); 72 DOM.languages.on("click", languageChanged);
70 disableForms(); 73 disableForms();
@@ -201,6 +204,11 @@
201 $("td.address span").toggleClass("invisible"); 204 $("td.address span").toggleClass("invisible");
202 } 205 }
203 206
207 function togglePublicKeys() {
208 showPubKey = !showPubKey;
209 $("td.pubkey span").toggleClass("invisible");
210 }
211
204 function togglePrivateKeys() { 212 function togglePrivateKeys() {
205 showPrivKey = !showPrivKey; 213 showPrivKey = !showPrivKey;
206 $("td.privkey span").toggleClass("invisible"); 214 $("td.privkey span").toggleClass("invisible");
@@ -399,11 +407,12 @@
399 } 407 }
400 var address = key.getAddress().toString(); 408 var address = key.getAddress().toString();
401 var privkey = key.privKey.toWIF(network); 409 var privkey = key.privKey.toWIF(network);
410 var pubkey = key.pubKey.toHex();
402 var indexText = getDerivationPath() + "/" + index; 411 var indexText = getDerivationPath() + "/" + index;
403 if (useHardenedAddresses) { 412 if (useHardenedAddresses) {
404 indexText = indexText + "'"; 413 indexText = indexText + "'";
405 } 414 }
406 addAddressToList(indexText, address, privkey); 415 addAddressToList(indexText, address, pubkey, privkey);
407 }, 50) 416 }, 50)
408 } 417 }
409 418
@@ -444,15 +453,17 @@
444 DOM.extendedPubKey.val(""); 453 DOM.extendedPubKey.val("");
445 } 454 }
446 455
447 function addAddressToList(indexText, address, privkey) { 456 function addAddressToList(indexText, address, pubkey, privkey) {
448 var row = $(addressRowTemplate.html()); 457 var row = $(addressRowTemplate.html());
449 // Elements 458 // Elements
450 var indexCell = row.find(".index span"); 459 var indexCell = row.find(".index span");
451 var addressCell = row.find(".address span"); 460 var addressCell = row.find(".address span");
461 var pubkeyCell = row.find(".pubkey span");
452 var privkeyCell = row.find(".privkey span"); 462 var privkeyCell = row.find(".privkey span");
453 // Content 463 // Content
454 indexCell.text(indexText); 464 indexCell.text(indexText);
455 addressCell.text(address); 465 addressCell.text(address);
466 pubkeyCell.text(pubkey);
456 privkeyCell.text(privkey); 467 privkeyCell.text(privkey);
457 // Visibility 468 // Visibility
458 if (!showIndex) { 469 if (!showIndex) {
@@ -461,6 +472,9 @@
461 if (!showAddress) { 472 if (!showAddress) {
462 addressCell.addClass("invisible"); 473 addressCell.addClass("invisible");
463 } 474 }
475 if (!showPubKey) {
476 pubkeyCell.addClass("invisible");
477 }
464 if (!showPrivKey) { 478 if (!showPrivKey) {
465 privkeyCell.addClass("invisible"); 479 privkeyCell.addClass("invisible");
466 } 480 }