Signed functions

The following functions operate on the built-in type Signed for signed messages.

Signed::checkSignature : forall a. PublicKey -> Signed a -> Bool

The function Signed::checkSignature checks whether the private key corresponding to the given PublicKey was used to signed the mssage.

Examples

type Answer : Event { answer: Signed String }
template WaitForAnswer(deepThought: PublicKey) =
    <*> a:Answer where
        Signed::checkSignature deepThought a.answer

Signed::message : forall a. Signed a -> a

The function Signed::message extracts the message from a Signed.

Examples

type Answer : Event { answer: Signed String }
template WaitForAnswer(deepThought: PublicKey) =
    <*> a:Answer where
        Signed::checkSignature deepThought a.answer
        && Signed::message a.answer = "42"