Closed cernekee closed 4 years ago
Thanks for this, it's a good change to have.
Let me know if you're keen to add these changes yourself to the jsbip39 library - https://github.com/iancoleman/jsbip39 if not I'll add them myself.
I had to change from populating with hex entropy to binary, see https://github.com/iancoleman/bip39/commit/700294714c39cb6e8226b960671a33dc93362edc
Happy to discuss further. My preference is to add a feature that allows manual selection of entropy type and filter invalid entropy chars based on that, which would then allow this feature to 'select' hex entropy and populate it with a hex value, rather than magically assume 000...
is binary when populated with some specific hex encodings, eg hex for abandon abandon ability
mnemonic is 00000000
which is interpreted as 8 bits of binary rather than 32 bits of hex.
See
https://github.com/iancoleman/bip39/commit/516c16d721db88b4b2c39964e2d5e8f6310c7bff - Allow manual override for entropy type
https://github.com/iancoleman/bip39/commit/244c76022af53c1f5b337a5a2cdb70358cf85e19 - Convert mnemonic to hex entropy instead of binary
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.