howardwu / wagyu

A Rust library for generating cryptocurrency wallets
https://wagyu.dev
Apache License 2.0
608 stars 108 forks source link

Explicitly require language flag for non-english mnemonics #275

Closed lightclient closed 1 year ago

lightclient commented 2 years ago

Fixes #274.

Before:

$ wagyu ethereum import-hd --mnemonic "candy maple cake sugar pudding cream honey rich smooth crumble sweet treatt"
Error: MnemonicError(WordlistError(InvalidWord("candy")))

$ wagyu ethereum import-hd --mnemonic "candy maple cake sugar pudding cream honey rich smooth crumble sweet treat"
... success

After:

$ wagyu ethereum import-hd --language "english" --mnemonic "candy maple cake sugar pudding cream honey rich smooth crumble sweet treatt"
Error: MnemonicError(WordlistError(InvalidWord("treatt")))

$ wagyu ethereum import-hd --language "english" --mnemonic "candy maple cake sugar pudding cream honey rich smooth crumble sweet treat"
... success

Note how much easier it is to track down the error when the correct error for the language is returned!

lightclient commented 2 years ago

@howardwu bumping.

lightclient commented 2 years ago

@howardwu bump.