mirror of
https://github.com/OneKeyHQ/bip39.git
synced 2026-05-28 11:34:45 +00:00
Standalone has hardened addresses checkbox
This commit is contained in:
+30
-1
@@ -190,6 +190,13 @@
|
|||||||
<input id="bip32-path" type="text" class="path form-control" value="m/0">
|
<input id="bip32-path" type="text" class="path form-control" value="m/0">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-sm-2"></div>
|
||||||
|
<label class="col-sm-10">
|
||||||
|
<input class="hardened-addresses" type="checkbox">
|
||||||
|
Use hardened addresses
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-2 control-label">Hive Wallet</label>
|
<label class="col-sm-2 control-label">Hive Wallet</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
@@ -208,6 +215,15 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="core-path" class="col-sm-2 control-label">Bitcoin Core</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<p class="form-control no-border">
|
||||||
|
Use path <code>m/0'/0'</code> with hardened addresses.
|
||||||
|
For more info see the <a href="https://github.com/bitcoin/bitcoin/pull/8035" target="_blank">Bitcoin Core BIP32 implementation</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -14853,6 +14869,7 @@ var Mnemonic = function(language) {
|
|||||||
DOM.bip44account = $("#bip44 .account");
|
DOM.bip44account = $("#bip44 .account");
|
||||||
DOM.bip44change = $("#bip44 .change");
|
DOM.bip44change = $("#bip44 .change");
|
||||||
DOM.strength = $(".strength");
|
DOM.strength = $(".strength");
|
||||||
|
DOM.hardenedAddresses = $(".hardened-addresses");
|
||||||
DOM.addresses = $(".addresses");
|
DOM.addresses = $(".addresses");
|
||||||
DOM.rowsToAdd = $(".rows-to-add");
|
DOM.rowsToAdd = $(".rows-to-add");
|
||||||
DOM.more = $(".more");
|
DOM.more = $(".more");
|
||||||
@@ -14876,6 +14893,7 @@ var Mnemonic = function(language) {
|
|||||||
DOM.bip44account.on("input", calcForDerivationPath);
|
DOM.bip44account.on("input", calcForDerivationPath);
|
||||||
DOM.bip44change.on("input", calcForDerivationPath);
|
DOM.bip44change.on("input", calcForDerivationPath);
|
||||||
DOM.tab.on("shown.bs.tab", calcForDerivationPath);
|
DOM.tab.on("shown.bs.tab", calcForDerivationPath);
|
||||||
|
DOM.hardenedAddresses.on("change", calcForDerivationPath);
|
||||||
DOM.indexToggle.on("click", toggleIndexes);
|
DOM.indexToggle.on("click", toggleIndexes);
|
||||||
DOM.addressToggle.on("click", toggleAddresses);
|
DOM.addressToggle.on("click", toggleAddresses);
|
||||||
DOM.privateKeyToggle.on("click", togglePrivateKeys);
|
DOM.privateKeyToggle.on("click", togglePrivateKeys);
|
||||||
@@ -15180,16 +15198,27 @@ var Mnemonic = function(language) {
|
|||||||
|
|
||||||
function TableRow(index) {
|
function TableRow(index) {
|
||||||
|
|
||||||
|
var useHardenedAddresses = DOM.hardenedAddresses.prop("checked");
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
calculateValues();
|
calculateValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
function calculateValues() {
|
function calculateValues() {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
var key = bip32ExtendedKey.derive(index);
|
var key = "";
|
||||||
|
if (useHardenedAddresses) {
|
||||||
|
key = bip32ExtendedKey.deriveHardened(index);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
key = bip32ExtendedKey.derive(index);
|
||||||
|
}
|
||||||
var address = key.getAddress().toString();
|
var address = key.getAddress().toString();
|
||||||
var privkey = key.privKey.toWIF(network);
|
var privkey = key.privKey.toWIF(network);
|
||||||
var indexText = getDerivationPath() + "/" + index;
|
var indexText = getDerivationPath() + "/" + index;
|
||||||
|
if (useHardenedAddresses) {
|
||||||
|
indexText = indexText + "'";
|
||||||
|
}
|
||||||
addAddressToList(indexText, address, privkey);
|
addAddressToList(indexText, address, privkey);
|
||||||
}, 50)
|
}, 50)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user