DOM.bip84accountXprv = $("#bip84 .account-xprv");
DOM.bip84accountXpub = $("#bip84 .account-xpub");
DOM.bip84change = $("#bip84 .change");
+ DOM.bip85 = $('.bip85');
+ DOM.showBip85 = $('.showBip85');
+ DOM.bip85Field = $('.bip85Field');
+ DOM.bip85application = $('#bip85-application');
+ DOM.bip85mnemonicLanguage = $('#bip85-mnemonic-language');
+ DOM.bip85mnemonicLanguageInput = $('.bip85-mnemonic-language-input');
+ DOM.bip85mnemonicLength = $('#bip85-mnemonic-length');
+ DOM.bip85mnemonicLengthInput = $('.bip85-mnemonic-length-input');
+ DOM.bip85index = $('#bip85-index');
+ DOM.bip85indexInput = $('.bip85-index-input');
+ DOM.bip85bytes = $('#bip85-bytes');
+ DOM.bip85bytesInput = $('.bip85-bytes-input');
DOM.bip141unavailable = $("#bip141 .unavailable");
DOM.bip141available = $("#bip141 .available");
DOM.bip141path = $("#bip141-path");
DOM.more.on("click", showMore);
DOM.seed.on("input", delayedSeedChanged);
DOM.rootKey.on("input", delayedRootKeyChanged);
+ DOM.showBip85.on('change', toggleBip85);
DOM.litecoinUseLtub.on("change", litecoinUseLtubChanged);
DOM.bip32path.on("input", calcForDerivationPath);
DOM.bip44account.on("input", calcForDerivationPath);
DOM.bip49change.on("input", calcForDerivationPath);
DOM.bip84account.on("input", calcForDerivationPath);
DOM.bip84change.on("input", calcForDerivationPath);
+ DOM.bip85application.on('input', calcBip85);
+ DOM.bip85mnemonicLanguage.on('change', calcBip85);
+ DOM.bip85mnemonicLength.on('change', calcBip85);
+ DOM.bip85index.on('input', calcBip85);
+ DOM.bip85bytes.on('input', calcBip85);
DOM.bip141path.on("input", calcForDerivationPath);
DOM.bip141semantics.on("change", tabChanged);
DOM.tab.on("shown.bs.tab", tabChanged);
var passphrase = DOM.passphrase.val();
calcBip32RootKeyFromSeed(phrase, passphrase);
calcForDerivationPath();
+ calcBip85();
// Show the word indexes
showWordIndexes();
writeSplitPhrase(phrase);
}
// Calculate and display
calcForDerivationPath();
+ calcBip85();
}
function rootKeyChanged() {
// Calculate and display
calcBip32RootKeyFromBase58(rootKeyBase58);
calcForDerivationPath();
+ calcBip85();
}
function litecoinUseLtubChanged() {
}
}
+ function toggleBip85() {
+ if (DOM.showBip85.prop('checked')) {
+ DOM.bip85.removeClass('hidden');
+ calcBip85();
+ } else {
+ DOM.bip85.addClass('hidden');
+ }
+ }
+
+ function toggleBip85Fields() {
+ if (DOM.showBip85.prop('checked')) {
+ DOM.bip85mnemonicLanguageInput.addClass('hidden');
+ DOM.bip85mnemonicLengthInput.addClass('hidden');
+ DOM.bip85bytesInput.addClass('hidden');
+
+ var app = DOM.bip85application.val();
+ if (app === 'bip39') {
+ DOM.bip85mnemonicLanguageInput.removeClass('hidden');
+ DOM.bip85mnemonicLengthInput.removeClass('hidden');
+ } else if (app === 'hex') {
+ DOM.bip85bytesInput.removeClass('hidden');
+ }
+ }
+ }
+
+ function calcBip85() {
+ if (!DOM.showBip85.prop('checked')) {
+ return
+ }
+
+ toggleBip85Fields();
+
+ var app = DOM.bip85application.val();
+
+ var phrase = DOM.phrase.val();
+ var passphrase = DOM.passphrase.val();
+ if (!phrase) {
+ return;
+ }
+ try {
+ var master = libs.bip85.BIP85.fromMnemonic(phrase, passphrase);
+
+ var result;
+
+ const index = parseInt(DOM.bip85index.val(), 10);
+
+ if (app === 'bip39') {
+ const language = parseInt(DOM.bip85mnemonicLanguage.val(), 10);
+ const length = parseInt(DOM.bip85mnemonicLength.val(), 10);
+
+ result = master.deriveBIP39(language, length, index).toMnemonic();
+ } else if (app === 'wif') {
+ result = master.deriveWIF(index).toWIF();
+ } else if (app === 'xprv') {
+ result = master.deriveXPRV(index).toXPRV();
+ } else if (app === 'hex') {
+ const bytes = parseInt(DOM.bip85bytes.val(), 10);
+
+ result = master.deriveHex(bytes, index).toEntropy();
+ }
+
+ hideValidationError();
+ DOM.bip85Field.val(result);
+ } catch (e) {
+ showValidationError('BIP85: ' + e.message);
+ DOM.bip85Field.val('');
+ }
+ }
+
function calcForDerivationPath() {
clearDerivedKeys();
clearAddressesList();
setHdCoin(235);
},
},
+ {
+ name: "FIRO - Firo",
+ onSelect: function() {
+ network = libs.bitcoin.networks.firo;
+ setHdCoin(136);
+ },
+ },
{
name: "FIX - FIX",
onSelect: function() {
setHdCoin(155);
},
},
- {
- name: "XZC - Zcoin",
- onSelect: function() {
- network = libs.bitcoin.networks.zcoin;
- setHdCoin(136);
- },
- },
{
name: "ZCL - Zclassic",
onSelect: function() {
};
testNetwork(done, params);
});
+ it('Allows selection of Firo', function(done) {
+ var params = {
+ selectText: "FIRO - Firo",
+ phrase: "abandon abandon ability",
+ firstAddress: "a6VcMdP4XgAA9Tr7xNszmPG5FZpfRf17Cq",
+ firstPubKey: "0236f2348c32dc62d69488b01988ed1154df261723ec60461cb6e62189984c62db",
+ firstPrivKey: "Y8k3XQRQrJoABEao4Sw45s744g6xth7yviNqFcN7zqPqKUJrrKTQ",
+ };
+ testNetwork(done, params);
+ });
it('Allows selection of Firstcoin', function(done) {
var params = {
selectText: "FRST - Firstcoin",
firstPubKey: "02d10b29f6d88dd86f733b2140ba2207a9dfb5d014bb287541c66a41e467e231a7",
firstPrivKey: "WmLWUvbz8UF1s7PrHyeQBMLbt4LpmQrwbzatvusvx6SRoNASbWtW",
};
- testNetwork(done, params);
- });
- it('Allows selection of Zcoin', function(done) {
- var params = {
- selectText: "XZC - Zcoin",
- phrase: "abandon abandon ability",
- firstAddress: "a6VcMdP4XgAA9Tr7xNszmPG5FZpfRf17Cq",
- firstPubKey: "0236f2348c32dc62d69488b01988ed1154df261723ec60461cb6e62189984c62db",
- firstPrivKey: "Y8k3XQRQrJoABEao4Sw45s744g6xth7yviNqFcN7zqPqKUJrrKTQ",
- };
testNetwork(done, params);
});
it('Allows selection of Zcash', function(done) {
});
});
+// Pull Request 454 https://github.com/iancoleman/bip39/pull/454
+// Add BIP85 support
+it('Show BIP85', function(done) {
+ var originalPhrase = "install scatter logic circle pencil average fall shoe quantum disease suspect usage";
+ driver.findElement(By.css('.phrase'))
+ .sendKeys(originalPhrase);
+ driver.sleep(generateDelay).then(function() {
+ driver.findElement(By.css('.showBip85')).click();
+ driver.findElement(By.css('.showBip85')).isSelected().then(function(isSelected) {
+ expect(isSelected).toBe(true)
+ driver.findElement(By.css('#bip85Field')).getAttribute("value").then(function(childMnemonic) {
+ expect(childMnemonic).toBe('girl mad pet galaxy egg matter matrix prison refuse sense ordinary nose')
+ done();
+ })
+ });
+ });
+});
+
// It allows manually specifying the entropy type
it('Allows entropy type to be manually selected', function(done) {
driver.findElement(By.css('.use-entropy'))