6

The tezos-client provides a sign method to sign a message in bytes using the private key and returns the signature.

Is there any method like verify which takes the message, the signature and the public key to verify that it is signed by the user who holds the private key?

3 Answers 3

2

You can find in this Repl how to check user signature in JavaScript:

I also added an example, just run it and you'll get the result.

https://repl.it/@DalyIng/verifyTezosSignature

4
  • Thanks, Daly it worked like a charm. Can you please also add a script to sign the message in Tezos? Commented Apr 11, 2020 at 14:47
  • 2
    @ShubhamChadokar, Here is the script to sign an operation on Tezos: repl.it/@DalyIng/signOperationTezos
    – Daly
    Commented Apr 12, 2020 at 16:49
  • Thank you @Daly for all your help. Commented Apr 12, 2020 at 17:27
  • if you rather use the octez-client (tezos-client) then the answer by @cousinit is the correct one. also ideally all SE answers should be self-contained, not requiring access to external resources.
    – ktorn
    Commented May 9, 2023 at 7:35
1
check that <bytes> was signed by <key> to produce <signature> [-q --quiet]

Check the signature of a byte sequence as per Michelson instruction CHECK_SIGNATURE.

bytes: the signed data

key: existing public_key alias

signature: the signature to check

-q --quiet: Use only exit codes

2
  • I think this requires a Smart contract with Check_signature function. Is there anything available in tezos-client? Commented Apr 7, 2020 at 11:01
  • This is the correct answer to this specific question, as tezos-client (now octez-client) does provide this utility. It can both sign and verify signatures.
    – ktorn
    Commented May 9, 2023 at 7:21
1

Taquito provides Validation functions including a signature validator.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.