spacemeshos / smcli

Spacemesh command-line tool
https://spacemesh.io/
MIT License
8 stars 9 forks source link

Whitespace in input mnemonic produces different seed #58

Closed lrettig closed 9 months ago

lrettig commented 9 months ago

The BIP39 spec doesn't say anything about how to handle whitespace. The library we're using, https://github.com/tyler-smith/go-bip39, does different things with whitespace depending on how you use it. We should probably ignore all whitespace and split the mnemonic into a list of words before turning it into a seed. We currently trim whitespace at the beginning and end of the mnemonic but not intermediate whitespace.

lrettig commented 9 months ago

Fixed in #59. We're not the first to get bitten by this, see:

https://github.com/iov-one/weave/pull/923 https://github.com/iov-one/weave/commit/fd82cc981f08f41ecbcc16f9ed8ad48665c17fdc#diff-6569bb577f21a71b8e731cb7dc0f2b24R96 https://github.com/tyler-smith/go-bip39/issues/29