<button class="address-toggle">Toggle</button>
</div>
</th>
+ <th>
+ <div class="input-group">
+ Public Key
+ <button class="public-key-toggle">Toggle</button>
+ </div>
+ </th>
<th>
<div class="input-group">
Private Key
<tr>
<td class="index"><span></span></td>
<td class="address"><span></span></td>
+ <td class="pubkey"><span></span></td>
<td class="privkey"><span></span></td>
</tr>
</script>
var showIndex = true;
var showAddress = true;
+ var showPubKey = true;
var showPrivKey = true;
var phraseChangeTimeoutEvent = null;
DOM.tab = $(".derivation-type a");
DOM.indexToggle = $(".index-toggle");
DOM.addressToggle = $(".address-toggle");
+ DOM.publicKeyToggle = $(".public-key-toggle");
DOM.privateKeyToggle = $(".private-key-toggle");
DOM.languages = $(".languages a");
DOM.hardenedAddresses.on("change", calcForDerivationPath);
DOM.indexToggle.on("click", toggleIndexes);
DOM.addressToggle.on("click", toggleAddresses);
+ DOM.publicKeyToggle.on("click", togglePublicKeys);
DOM.privateKeyToggle.on("click", togglePrivateKeys);
DOM.languages.on("click", languageChanged);
disableForms();
$("td.address span").toggleClass("invisible");
}
+ function togglePublicKeys() {
+ showPubKey = !showPubKey;
+ $("td.pubkey span").toggleClass("invisible");
+ }
+
function togglePrivateKeys() {
showPrivKey = !showPrivKey;
$("td.privkey span").toggleClass("invisible");
}
var address = key.getAddress().toString();
var privkey = key.privKey.toWIF(network);
+ var pubkey = key.pubKey.toHex();
var indexText = getDerivationPath() + "/" + index;
if (useHardenedAddresses) {
indexText = indexText + "'";
}
- addAddressToList(indexText, address, privkey);
+ addAddressToList(indexText, address, pubkey, privkey);
}, 50)
}
DOM.extendedPubKey.val("");
}
- function addAddressToList(indexText, address, privkey) {
+ function addAddressToList(indexText, address, pubkey, privkey) {
var row = $(addressRowTemplate.html());
// Elements
var indexCell = row.find(".index span");
var addressCell = row.find(".address span");
+ var pubkeyCell = row.find(".pubkey span");
var privkeyCell = row.find(".privkey span");
// Content
indexCell.text(indexText);
addressCell.text(address);
+ pubkeyCell.text(pubkey);
privkeyCell.text(privkey);
// Visibility
if (!showIndex) {
if (!showAddress) {
addressCell.addClass("invisible");
}
+ if (!showPubKey) {
+ pubkeyCell.addClass("invisible");
+ }
if (!showPrivKey) {
privkeyCell.addClass("invisible");
}
<button class="address-toggle">Toggle</button>
</div>
</th>
+ <th>
+ <div class="input-group">
+ Public Key
+ <button class="public-key-toggle">Toggle</button>
+ </div>
+ </th>
<th>
<div class="input-group">
Private Key
<tr>
<td class="index"><span></span></td>
<td class="address"><span></span></td>
+ <td class="pubkey"><span></span></td>
<td class="privkey"><span></span></td>
</tr>
</script>
var showIndex = true;
var showAddress = true;
+ var showPubKey = true;
var showPrivKey = true;
var phraseChangeTimeoutEvent = null;
DOM.tab = $(".derivation-type a");
DOM.indexToggle = $(".index-toggle");
DOM.addressToggle = $(".address-toggle");
+ DOM.publicKeyToggle = $(".public-key-toggle");
DOM.privateKeyToggle = $(".private-key-toggle");
DOM.languages = $(".languages a");
DOM.hardenedAddresses.on("change", calcForDerivationPath);
DOM.indexToggle.on("click", toggleIndexes);
DOM.addressToggle.on("click", toggleAddresses);
+ DOM.publicKeyToggle.on("click", togglePublicKeys);
DOM.privateKeyToggle.on("click", togglePrivateKeys);
DOM.languages.on("click", languageChanged);
disableForms();
$("td.address span").toggleClass("invisible");
}
+ function togglePublicKeys() {
+ showPubKey = !showPubKey;
+ $("td.pubkey span").toggleClass("invisible");
+ }
+
function togglePrivateKeys() {
showPrivKey = !showPrivKey;
$("td.privkey span").toggleClass("invisible");
}
var address = key.getAddress().toString();
var privkey = key.privKey.toWIF(network);
+ var pubkey = key.pubKey.toHex();
var indexText = getDerivationPath() + "/" + index;
if (useHardenedAddresses) {
indexText = indexText + "'";
}
- addAddressToList(indexText, address, privkey);
+ addAddressToList(indexText, address, pubkey, privkey);
}, 50)
}
DOM.extendedPubKey.val("");
}
- function addAddressToList(indexText, address, privkey) {
+ function addAddressToList(indexText, address, pubkey, privkey) {
var row = $(addressRowTemplate.html());
// Elements
var indexCell = row.find(".index span");
var addressCell = row.find(".address span");
+ var pubkeyCell = row.find(".pubkey span");
var privkeyCell = row.find(".privkey span");
// Content
indexCell.text(indexText);
addressCell.text(address);
+ pubkeyCell.text(pubkey);
privkeyCell.text(privkey);
// Visibility
if (!showIndex) {
if (!showAddress) {
addressCell.addClass("invisible");
}
+ if (!showPubKey) {
+ pubkeyCell.addClass("invisible");
+ }
if (!showPrivKey) {
privkeyCell.addClass("invisible");
}
});
},
+// Public key is shown
+function() {
+page.open(url, function(status) {
+ var expected = "033f5aed5f6cfbafaf223188095b5980814897295f723815fea5d3f4b648d0d0b3";
+ // set the phrase
+ page.evaluate(function() {
+ $(".phrase").val("abandon abandon ability").trigger("input");
+ });
+ // get the address
+ waitForGenerate(function() {
+ var actual = page.evaluate(function() {
+ return $(".pubkey:first").text();
+ });
+ if (actual != expected) {
+ console.log("Public key is not shown");
+ console.log("Expected: " + expected);
+ console.log("Got: " + actual);
+ fail();
+ }
+ next();
+ });
+});
+},
+
+// Public key visibility can be toggled
+function() {
+page.open(url, function(status) {
+ // set the phrase
+ page.evaluate(function() {
+ $(".phrase").val("abandon abandon ability");
+ $(".phrase").trigger("input");
+ });
+ waitForGenerate(function() {
+ // toggle public key visibility
+ page.evaluate(function() {
+ $(".public-key-toggle").click();
+ });
+ // check the public key is not visible
+ var isInvisible = page.evaluate(function() {
+ return $(".pubkey:first span").hasClass("invisible");
+ });
+ if (!isInvisible) {
+ console.log("Toggled public key is visible");
+ fail();
+ }
+ next();
+ });
+});
+},
+
// Private key is shown
function() {
page.open(url, function(status) {