HydroSign
This module contains functions for signing data, both single- and multi-part.
Example:
(def context (Hydro.context "Examples"))
(def msg (Hydro.buf "Test"))
(let [keypair (HydroSign.keygen)
signature (Maybe.unsafe-from (HydroSign.create msg context
keypair))]
(println* (HydroSign.verify signature msg context keypair))))
create
(Fn [(Ref (Array Byte) a), (Ptr CChar), (Ref HydroSignKeyPair b)] (Maybe (Array Byte)))
(create msg ctx keypair)
signs a message msg
, using the context ctx
and the keypair
keypair
.
final-create
(Fn [(Ref HydroSignState a), (Ref HydroSignKeyPair b)] (Maybe (Array Byte)))
(final-create s keypair)
finalizes a sign state s
with a keypair keypair
.
Returns a signature.
final-verify
(Fn [(Ref HydroSignState a), (Array Byte), (Ref HydroSignKeyPair b)] Bool)
(final-verify s signature keypair)
finalizes a sign state s
with a signature signature
and a keypair keypair
. Returns a boolean signifying whether we were able to
verify the signature.
init
(Fn [(Ref HydroSignState a), (Ptr CChar)] Bool)
initializes a state for multi-part signing, using a context.
update
(Fn [(Ref HydroSignState a), (Ref (Array Byte) b)] Int)
(update s buf)
updates a sign state s
with a buffer buf
.
verify
(Fn [(Ref (Array Byte) a), (Ref (Array Byte) b), (Ptr CChar), (Ref HydroSignKeyPair c)] Bool)
(verify signature msg ctx keypair)
verifies a signature signature
for a message msg
, using the
context ctx
and the keypair keypair
.