2
0
mirror of synced 2025-02-24 03:58:06 +00:00

Make mnemonics case-agnostic (#557).

This commit is contained in:
Richard Moore 2019-07-09 16:51:07 -04:00
parent a5296a9258
commit ef91dcd757
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651

View File

@ -261,8 +261,8 @@ function _fromSeed(seed: Arrayish, mnemonic: string): HDNode {
}
export function fromMnemonic(mnemonic: string, wordlist?: Wordlist, password?: string): HDNode {
// Check that the checksum s valid (will throw an error)
mnemonicToEntropy(mnemonic, wordlist);
// Normalize the mnemonic (also throws if the checksum is invalid)
mnemonic = entropyToMnemonic(mnemonicToEntropy(mnemonic, wordlist), wordlist);
return _fromSeed(mnemonicToSeed(mnemonic, password), mnemonic);
}