X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=bip39-standalone.html;h=367d9a2fdc1d923728b3cf88e45a1c2f18a0f0c6;hb=ba3cb9ecae2667e98af71f5b38a862ba604e8e1c;hp=45380a339fb1c8a600e536416a38e1c4b18602ff;hpb=20083ab9e9ae519400447fc97c3cd1b86ffcad57;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FBIP39.git
diff --git a/bip39-standalone.html b/bip39-standalone.html
index 45380a3..367d9a2 100644
--- a/bip39-standalone.html
+++ b/bip39-standalone.html
@@ -96,8 +96,15 @@
.qr-image {
margin: 5px;
}
- .qr-hint {
+ .qr-hint,
+ .qr-warning {
padding: 2px;
+ max-width: 150px;
+ }
+ .more-info {
+ cursor: help;
+ border-bottom: 1px dashed #000;
+ text-decoration: none;
}
@@ -169,7 +176,7 @@
-
The account extendend keys can be used for importing to most BIP44 compatible wallets, such as mycelium or electrum.
+
The account extended keys can be used for importing to most BIP44 compatible wallets, such as mycelium or electrum.
@@ -14702,7 +14718,8 @@ sjcl.hash.sha256.prototype = {
//
//
Test
//
keep em tag
-//
+//
+//
//
// Obtain all the phrases to be translated via js debug console:
//
@@ -14717,7 +14734,8 @@ sjcl.hash.sha256.prototype = {
// Translate.loadForeignPhrases("es", {
// "Test": "Test in Spanish",
// "
keep em tag ": "
keep em tag in Spanish ",
-// "Example text": "Example text in Spanish"
+// "Example placeholder": "Example placeholder in Spanish"
+// "Example title": "Example title in Spanish"
// });
//
// In your UI put a listener for clicking on the Spanish button:
@@ -14768,10 +14786,21 @@ Translate = new (function() {
},
}
+ var title = {
+ selector: "[data-translate-title]",
+ getKey: function() {
+ return this.getAttribute("title").trim().replace(/\s+/g, " ");
+ },
+ setPhrase: function(p) {
+ this.setAttribute("title", p);
+ },
+ }
+
// Get elements to be translated
var allEls = getEls(text)
.concat(getEls(html))
- .concat(getEls(placeholder));
+ .concat(getEls(placeholder))
+ .concat(getEls(title));
// Provides access to phrases from a non-default language.
// See phrases_en.js for example usage.
@@ -18624,7 +18653,7 @@ window.Entropy = new (function() {
var showAddress = true;
var showPubKey = true;
var showPrivKey = true;
- var showQr = true;
+ var showQr = false;
var entropyChangeTimeoutEvent = null;
var phraseChangeTimeoutEvent = null;
@@ -18678,6 +18707,7 @@ window.Entropy = new (function() {
DOM.privateKeyToggle = $(".private-key-toggle");
DOM.languages = $(".languages a");
DOM.qrContainer = $(".qr-container");
+ DOM.qrHider = DOM.qrContainer.find(".qr-hider");
DOM.qrImage = DOM.qrContainer.find(".qr-image");
DOM.qrHint = DOM.qrContainer.find(".qr-hint");
DOM.showQrEls = $("[data-show-qr]");
@@ -18838,11 +18868,11 @@ window.Entropy = new (function() {
// Calculate and display
calcBip32RootKeyFromBase58(rootKeyBase58);
calcForDerivationPath();
- hidePending();
}
function calcForDerivationPath() {
showPending();
+ clearAddressesList();
hideValidationError();
// Get the derivation path
var derivationPath = getDerivationPath();
@@ -18944,7 +18974,12 @@ window.Entropy = new (function() {
continue;
}
var hardened = bit[bit.length-1] == "'";
- if (hardened) {
+ var isPriv = "privKey" in extendedKey;
+ var invalidDerivationPath = hardened && !isPriv;
+ if (invalidDerivationPath) {
+ extendedKey = null;
+ }
+ else if (hardened) {
extendedKey = extendedKey.deriveHardened(index);
}
else {
@@ -19063,6 +19098,12 @@ window.Entropy = new (function() {
}
}
}
+ // Check no hardened derivation path when using xpub keys
+ var hardened = path.indexOf("'") > -1;
+ var isXpubkey = !("privKey" in bip32RootKey);
+ if (hardened && isXpubkey) {
+ return "Hardened derivation path is invalid with xpub key";
+ }
return false;
}
@@ -19089,7 +19130,11 @@ window.Entropy = new (function() {
DOM.seed.val(seed);
var rootKey = bip32RootKey.toBase58();
DOM.rootKey.val(rootKey);
- var extendedPrivKey = bip32ExtendedKey.toBase58();
+ var xprvkeyB58 = "NA";
+ if (bip32ExtendedKey.privKey) {
+ xprvkeyB58 = bip32ExtendedKey.toBase58();
+ }
+ var extendedPrivKey = xprvkeyB58;
DOM.extendedPrivKey.val(extendedPrivKey);
var extendedPubKey = bip32ExtendedKey.toBase58(false);
DOM.extendedPubKey.val(extendedPubKey);
@@ -19123,7 +19168,10 @@ window.Entropy = new (function() {
key = bip32ExtendedKey.derive(index);
}
var address = key.getAddress().toString();
- var privkey = key.privKey.toWIF(network);
+ var privkey = "NA";
+ if (key.privKey) {
+ privkey = key.privKey.toWIF(network);
+ }
var pubkey = key.pubKey.toHex();
var indexText = getDerivationPath() + "/" + index;
if (useHardenedAddresses) {
@@ -19557,7 +19605,10 @@ window.Entropy = new (function() {
var size = 130;
DOM.qrImage.qrcode({width: size, height: size, text: content});
if (!showQr) {
- DOM.qrImage.addClass("hidden");
+ DOM.qrHider.addClass("hidden");
+ }
+ else {
+ DOM.qrHider.removeClass("hidden");
}
DOM.qrContainer.removeClass("hidden");
}
@@ -19570,7 +19621,7 @@ window.Entropy = new (function() {
function toggleQr() {
showQr = !showQr;
- DOM.qrImage.toggleClass("hidden");
+ DOM.qrHider.toggleClass("hidden");
DOM.qrHint.toggleClass("hidden");
}