mirror of
https://github.com/OneKeyHQ/bip39.git
synced 2026-05-24 01:24:45 +00:00
Allow converting mnemonic back to raw entropy value
Currently, this sequence produces an unexpected result: 1) Navigate to bip39-standalone.html 2) Paste a known-good mnemonic into the BIP39 Mnemonic field 3) Select "Show entropy details" This will erase the BIP39 Mnemonic field and most of the derived address/key information. It shows an empty Entropy field, and zeroes for Event Count, Bits Per Event, Raw Entropy Words, Total Bits, etc. However, it will show valid Word Indexes and BIP39 Seed. The way to fix it is to convert the mnemonic back into a raw entropy value and populate it in DOM.entropy, so that everything stays consistent. This will only happen if the mnemonic is manually entered by the user, not if phraseChanged() is triggered by hand-editing the entropy value.
This commit is contained in:
+8
-1
@@ -232,7 +232,14 @@
|
||||
if (phraseChangeTimeoutEvent != null) {
|
||||
clearTimeout(phraseChangeTimeoutEvent);
|
||||
}
|
||||
phraseChangeTimeoutEvent = setTimeout(phraseChanged, 400);
|
||||
phraseChangeTimeoutEvent = setTimeout(function() {
|
||||
phraseChanged();
|
||||
var entropy = mnemonic.toRawEntropyHex(DOM.phrase.val());
|
||||
if (entropy !== null) {
|
||||
DOM.entropyMnemonicLength.val("raw");
|
||||
DOM.entropy.val(entropy);
|
||||
}
|
||||
}, 400);
|
||||
}
|
||||
|
||||
function phraseChanged() {
|
||||
|
||||
Reference in New Issue
Block a user