Module Crypto.ED25519
type t
= t
The type that will be used to represent contiguous bytes; typically either Bytes.t or Cstruct.t
val publicKey : t -> t
publicKey sk
computes the 32-byte ED25519 public key for the secret keysk
.- raises Crypto_failure
when the secret key is not 32 bytes
val checkValid : t -> t -> t -> bool
checkValid s m pk
checks the messagem
for a valid signatures
signed by the private key that corresponds to the raw public keypk
.- raises Crypto_failure
when the signature is not 64 bytes or the public key is not 32 bytes
val signature : t -> t -> t -> t
signature m sk pk
calculates the ED25519 signature ofm
with a raw 32-byte secret keysk
and its corresponding raw 32-byte public keypk
created with(
publicKey
sk
.WARNING: It is incorrect to create a ED25519 signature using a public key
pk
that is not derived from the secret keysk
. You provide thepk
simply because doing so is the ProScript API, and because it can be a performance win to not recomputepublicKey
each time you do a signature.1. You need to hex encode the message.
Checks may or may not be performed to verify you gave the correct public key. Implementations have the freedom to ignore whatever public key you provide (ex.
dirsp-proscript-mirage
will recompute the public key and ignore your public key).- raises Crypto_failure
when the secret or public key is not 32 bytes