From 1d485b0242713832d79da8b1e046d60b87462e52 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Fri, 17 Jan 2020 02:08:07 -0800 Subject: [PATCH] Add signature checking to tezos specific functions page --- .../docs/language-basics/tezos-specific.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/gitlab-pages/docs/language-basics/tezos-specific.md b/gitlab-pages/docs/language-basics/tezos-specific.md index ff1cf6644..1d28fe322 100644 --- a/gitlab-pages/docs/language-basics/tezos-specific.md +++ b/gitlab-pages/docs/language-basics/tezos-specific.md @@ -78,3 +78,37 @@ let check_hash_key = (kh1_k2: (key_hash, key)) : (bool, key_hash) => { ``` + +## Checking Signatures + +> ⚠️ There is no way to *generate* a signed message in LIGO. This is because that +would require storing a private key on chain, at which point it isn't very private +anymore. + + + + +```pascaligo +function check_signature + (const pk: key; + const signed: signature; + const msg: bytes) : bool + is crypto_check(pk, signed, msg) +``` + + +```cameligo +let check_signature (pk, signed, msg: key * signature * bytes) : bool = + Crypto.check pk signed msg +``` + + +```reasonligo +let check_signature = (param: (key, signature, bytes)) : bool => { + let pk, signed, msg = param; + Crypto.check(pk, signed, msg); +}; +``` + + +