mirror of
https://github.com/OneKeyHQ/bip39.git
synced 2026-05-13 12:15:04 +00:00
Public key column in table, shown as hex
This commit is contained in:
+23
-2
@@ -298,6 +298,12 @@
|
||||
<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
|
||||
@@ -442,6 +448,7 @@
|
||||
<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>
|
||||
@@ -16172,6 +16179,7 @@ var Mnemonic = function(language) {
|
||||
|
||||
var showIndex = true;
|
||||
var showAddress = true;
|
||||
var showPubKey = true;
|
||||
var showPrivKey = true;
|
||||
|
||||
var phraseChangeTimeoutEvent = null;
|
||||
@@ -16206,6 +16214,7 @@ var Mnemonic = function(language) {
|
||||
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");
|
||||
|
||||
@@ -16226,6 +16235,7 @@ var Mnemonic = function(language) {
|
||||
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();
|
||||
@@ -16362,6 +16372,11 @@ var Mnemonic = function(language) {
|
||||
$("td.address span").toggleClass("invisible");
|
||||
}
|
||||
|
||||
function togglePublicKeys() {
|
||||
showPubKey = !showPubKey;
|
||||
$("td.pubkey span").toggleClass("invisible");
|
||||
}
|
||||
|
||||
function togglePrivateKeys() {
|
||||
showPrivKey = !showPrivKey;
|
||||
$("td.privkey span").toggleClass("invisible");
|
||||
@@ -16560,11 +16575,12 @@ var Mnemonic = function(language) {
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -16605,15 +16621,17 @@ var Mnemonic = function(language) {
|
||||
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) {
|
||||
@@ -16622,6 +16640,9 @@ var Mnemonic = function(language) {
|
||||
if (!showAddress) {
|
||||
addressCell.addClass("invisible");
|
||||
}
|
||||
if (!showPubKey) {
|
||||
pubkeyCell.addClass("invisible");
|
||||
}
|
||||
if (!showPrivKey) {
|
||||
privkeyCell.addClass("invisible");
|
||||
}
|
||||
|
||||
@@ -294,6 +294,12 @@
|
||||
<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
|
||||
@@ -438,6 +444,7 @@
|
||||
<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>
|
||||
|
||||
+16
-2
@@ -11,6 +11,7 @@
|
||||
|
||||
var showIndex = true;
|
||||
var showAddress = true;
|
||||
var showPubKey = true;
|
||||
var showPrivKey = true;
|
||||
|
||||
var phraseChangeTimeoutEvent = null;
|
||||
@@ -45,6 +46,7 @@
|
||||
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");
|
||||
|
||||
@@ -65,6 +67,7 @@
|
||||
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();
|
||||
@@ -201,6 +204,11 @@
|
||||
$("td.address span").toggleClass("invisible");
|
||||
}
|
||||
|
||||
function togglePublicKeys() {
|
||||
showPubKey = !showPubKey;
|
||||
$("td.pubkey span").toggleClass("invisible");
|
||||
}
|
||||
|
||||
function togglePrivateKeys() {
|
||||
showPrivKey = !showPrivKey;
|
||||
$("td.privkey span").toggleClass("invisible");
|
||||
@@ -399,11 +407,12 @@
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -444,15 +453,17 @@
|
||||
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) {
|
||||
@@ -461,6 +472,9 @@
|
||||
if (!showAddress) {
|
||||
addressCell.addClass("invisible");
|
||||
}
|
||||
if (!showPubKey) {
|
||||
pubkeyCell.addClass("invisible");
|
||||
}
|
||||
if (!showPrivKey) {
|
||||
privkeyCell.addClass("invisible");
|
||||
}
|
||||
|
||||
@@ -1166,6 +1166,56 @@ page.open(url, function(status) {
|
||||
});
|
||||
},
|
||||
|
||||
// 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) {
|
||||
|
||||
Reference in New Issue
Block a user