Skip to content

Commit

Permalink
fix issue where wallet mnemonics were not normalised to NFKD
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdee committed Sep 21, 2020
1 parent f0ad104 commit 829dbd3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Development:
- fix issue where wallet mnemonics were not normalised to NFKD
- "block info" supports fetching the gensis block (--slot=0)
- "attester inclusion" command finds the inclusion slot for a validator's attestation
- "account info" with verbose option now displays participants for distributed accounts
Expand Down
4 changes: 4 additions & 0 deletions cmd/walletcreate.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
keystorev4 "github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4"
hd "github.com/wealdtech/go-eth2-wallet-hd/v2"
nd "github.com/wealdtech/go-eth2-wallet-nd/v2"
"golang.org/x/text/unicode/norm"
)

var walletCreateCmd = &cobra.Command{
Expand Down Expand Up @@ -106,6 +107,9 @@ func walletCreateHD(ctx context.Context, name string, passphrase string, mnemoni
mnemonicPassphrase = strings.Join(mnemonicParts[24:], " ")
}
}
// Normalise the input.
mnemonic = string(norm.NFKD.Bytes([]byte(mnemonic)))
mnemonicPassphrase = string(norm.NFKD.Bytes([]byte(mnemonicPassphrase)))

// Ensure the mnemonic is valid
if !bip39.IsMnemonicValid(mnemonic) {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ require (
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a // indirect
golang.org/x/net v0.0.0-20200822124328-c89045814202 // indirect
golang.org/x/sys v0.0.0-20200821140526-fda516888d29 // indirect
golang.org/x/text v0.3.3 // indirect
golang.org/x/text v0.3.3
google.golang.org/genproto v0.0.0-20200815001618-f69a88009b70 // indirect
google.golang.org/grpc v1.31.0
gopkg.in/ini.v1 v1.60.1 // indirect
Expand Down

0 comments on commit 829dbd3

Please sign in to comment.