Skip to content

Commit

Permalink
Merge pull request #1644 from 0chain/fix/add-verify-signature
Browse files Browse the repository at this point in the history
Fix/add verify signature
  • Loading branch information
dabasov authored Oct 22, 2024
2 parents 653c149 + 7af1667 commit f894a13
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions core/client/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,3 +297,21 @@ func PopulateClient(walletJSON, signatureScheme string) (zcncrypto.Wallet, error
SetSignatureScheme(signatureScheme)
return wallet, nil
}

func VerifySignature(signature string, msg string) (bool, error) {
ss := zcncrypto.NewSignatureScheme(client.signatureScheme)
if err := ss.SetPublicKey(PublicKey()); err != nil {
return false, err
}

return ss.Verify(signature, msg)
}

func VerifySignatureWith(pubKey, signature, hash string) (bool, error) {
sch := zcncrypto.NewSignatureScheme(client.signatureScheme)
err := sch.SetPublicKey(pubKey)
if err != nil {
return false, err
}
return sch.Verify(signature, hash)
}

0 comments on commit f894a13

Please sign in to comment.