Derive from the mnemonic's words joined by single spaces (closes #49)
check / check (push) Successful in 2m40s
check / check (push) Successful in 2m40s
The seed is computed over the mnemonic string itself, and only its ends were trimmed, so the same words one per line, tab-separated or double-spaced passed the checksum but gave different keys. The words are now joined with single spaces before the checksum and the seed. A test shows each of those three spacings gives the README SSH vector, and the README section on giving the mnemonic says so. Model: opus-5-5
This commit is contained in:
@@ -104,10 +104,11 @@ func ask() (string, error) {
|
||||
return checked(string(typed))
|
||||
}
|
||||
|
||||
// checked drops the surrounding whitespace and refuses a mnemonic that
|
||||
// does not pass the BIP-39 checksum.
|
||||
// checked joins the words with single spaces, whatever whitespace
|
||||
// separated them, since the seed is computed over the string itself,
|
||||
// and refuses a mnemonic that does not pass the BIP-39 checksum.
|
||||
func checked(words string) (string, error) {
|
||||
words = strings.TrimSpace(words)
|
||||
words = strings.Join(strings.Fields(words), " ")
|
||||
|
||||
if !bip39.IsMnemonicValid(words) {
|
||||
return "", ErrChecksum
|
||||
|
||||
Reference in New Issue
Block a user