Skip to content

Commit

Permalink
fix(cmd/wallet): Support 0x when importing secp256k1
Browse files Browse the repository at this point in the history
  • Loading branch information
amela committed May 8, 2024
1 parent f4e49b2 commit 6bc50bf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion wallet/file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"fmt"
"os"
"path/filepath"
"strings"

Check failure on line 11 in wallet/file/file.go

View workflow job for this annotation

GitHub Actions / lint

"strings" imported and not used) (typecheck)

Check failure on line 11 in wallet/file/file.go

View workflow job for this annotation

GitHub Actions / lint

"strings" imported and not used) (typecheck)

Check failure on line 11 in wallet/file/file.go

View workflow job for this annotation

GitHub Actions / lint

"strings" imported and not used (typecheck)

Check failure on line 11 in wallet/file/file.go

View workflow job for this annotation

GitHub Actions / tests-ubuntu-latest

"strings" imported and not used

"github.com/AlecAivazis/survey/v2"
ethCommon "github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -279,7 +280,7 @@ func (af *fileAccountFactory) DataValidator(kind wallet.ImportKind, rawCfg map[s
}
case wallet.AlgorithmSecp256k1Raw:
// Ensure the private key is hex encoded.
_, err := hex.DecodeString(ans.(string))
_, err := Secp256k1FromHex(ans.(string))
if err != nil {
return fmt.Errorf("private key must be hex-encoded (without leading 0x): %w", err)
}
Expand Down

0 comments on commit 6bc50bf

Please sign in to comment.