Skip to content

Commit

Permalink
wip: refactor obsolete marshal
Browse files Browse the repository at this point in the history
  • Loading branch information
notanatol committed Jan 15, 2024
1 parent 15ad6cb commit 0939ba6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/crypto/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func NewEthereumAddress(p ecdsa.PublicKey) ([]byte, error) {
if p.X == nil || p.Y == nil {
return nil, errors.New("invalid public key")
}
pubBytes, _ := p.ECDH() // elliptic.Marshal(btcec.S256(), p.X, p.Y)
pubBytes, _ := p.ECDH()
pubHash, err := LegacyKeccak256(pubBytes.Bytes()[1:])
if err != nil {
return nil, err
Expand Down
3 changes: 2 additions & 1 deletion pkg/keystore/file/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ func encryptKey(k *ecdsa.PrivateKey, password string, edg keystore.EDG) ([]byte,
}
addr = a
case elliptic.P256():
addr = elliptic.Marshal(elliptic.P256(), k.PublicKey.X, k.PublicKey.Y)
pubBytes, _ := k.ECDH()
addr = pubBytes.Bytes()
default:
return nil, fmt.Errorf("unsupported curve: %v", k.PublicKey.Curve)
}
Expand Down

0 comments on commit 0939ba6

Please sign in to comment.