mirror of
https://github.com/wealdtech/ethdo.git
synced 2026-01-07 21:24:01 -05:00
Avoid corner case when deriving from mnemonic.
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
1.36.5:
|
||||
- avoid corner case mnemonic derivation with 25th word
|
||||
|
||||
1.36.2:
|
||||
- avoid crash when signing and verifing signatures using keys rather than accounts
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import (
|
||||
|
||||
// ReleaseVersion is the release version of the codebase.
|
||||
// Usually overridden by tag names when building binaries.
|
||||
var ReleaseVersion = "local build (latest release 1.36.4)"
|
||||
var ReleaseVersion = "local build (latest release 1.36.5)"
|
||||
|
||||
// versionCmd represents the version command.
|
||||
var versionCmd = &cobra.Command{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Copyright © 2020 - 2025 Weald Technology Trading
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
@@ -56,6 +57,12 @@ func ParseAccount(ctx context.Context,
|
||||
account, err = parseAccountFromKeystorePath(ctx, accountStr, supplementary, unlock)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
if strings.Count(accountStr, " ") > 7 {
|
||||
// It is also possible that this is a mnemonic with "/" in the additional word, so try that as well.
|
||||
account, err = parseAccountFromMnemonic(ctx, accountStr, supplementary, unlock)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright © 2020 Weald Technology Trading
|
||||
// Copyright © 2020 - 2025 Weald Technology Trading
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
@@ -75,6 +75,18 @@ func TestParseAccount(t *testing.T) {
|
||||
supplementary: []string{"m/12381/3600/0/0"},
|
||||
expectedPubkey: "0x99b1f1d84d76185466d86c34bde1101316afddae76217aa86cd066979b19858c2c9d9e56eebc1e067ac54277a61790db",
|
||||
},
|
||||
{
|
||||
name: "ShortMnemonic",
|
||||
accountStr: "aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban art",
|
||||
supplementary: []string{"m/12381/3600/0/0"},
|
||||
expectedPubkey: "0x99b1f1d84d76185466d86c34bde1101316afddae76217aa86cd066979b19858c2c9d9e56eebc1e067ac54277a61790db",
|
||||
},
|
||||
{
|
||||
name: "ShortMnemonicWith25th",
|
||||
accountStr: `aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban aban art !"£$%^&*()<>,./?;:'@#~]}[{-_=+`,
|
||||
supplementary: []string{"m/12381/3600/0/0"},
|
||||
expectedPubkey: "0xa9264986cbde1f05d4c37ed57b03c476f360f0c64cf4a41752c3d352f60caebb6555c5522f0f962962a619336e1539f2",
|
||||
},
|
||||
{
|
||||
name: "MnemonicUnlocked",
|
||||
accountStr: "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon art",
|
||||
|
||||
Reference in New Issue
Block a user