tyler-smith / go-bip39

The BIP39 library for Go.
MIT License
547 stars 195 forks source link

unable to determine outcome based on API shape: NewSeed should return ([]byte, error). #37

Open sneak opened 3 years ago

sneak commented 3 years ago
  seed := bip39.NewSeed(mnemonic, "Secret Passphrase")

This should return ([]byte, error) and validate the mnemonic. Without reading your library, it's unclear what happens if you pass in a mnemonic that's the wrong number of words, or contains words not on the wordlist, et c.

tyler-smith commented 3 years ago

You are right, this is a bad API design. You should explicitly check that the mnemonic is valid with the provided utility functions. In v2 there will be no way to instantiate an invalid mnemonic without an error being presented.