Skip to content

Commit

Permalink
create local copy of signature when verify
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaiba committed Aug 15, 2023
1 parent 16f4193 commit 428e536
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/crypto/secp256k1.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ func (s *Secp256k1PublicKey) Type() KeyType {
func (s *Secp256k1PublicKey) Verify(sig *Signature, msg []byte) error {
hash := ethAccount.TextHash(msg)
// Remove recovery ID
sig.Signature = sig.Signature[:len(sig.Signature)-1]
if !ethCrypto.VerifySignature(s.Bytes(), hash, sig.Signature) {
signature := sig.Signature[:len(sig.Signature)-1]
if !ethCrypto.VerifySignature(s.Bytes(), hash, signature) {
return fmt.Errorf("invalid signature")
}

Expand Down

0 comments on commit 428e536

Please sign in to comment.