package ttweetnacl

  1. Overview
  2. Docs

Signatures.

The primitive is Ed25519 and SHA-512. NaCl documentation.

Keys

module Public_key : sig ... end

Public keys.

module Secret_key : sig ... end

Secret keys.

val keypair : unit -> Public_key.t * Secret_key.t

keypair () randomly generates a secret key and its corresponding public key. The function blocks until enough entropy is gathered.

Sign

type plain_text = Bytes.t

The type for unsigned plain text.

type signed_text = Bytes.t

The type for signed text.

val signed_text_max_overhead_length : int

signed_text_max_overhead_length is the maximal additional number of bytes a signed text has over its plain text.

val sign : secret_key:Secret_key.t -> plain_text:plain_text -> signed_text

sign ~secret_key ~plain_text is plain_text signed by secret_key.

val open' : public_key:Public_key.t -> signed_text:signed_text -> plain_text option

open' ~public_key ~signed_text is:

  • Some plain_text, if public_key successfully verifies the signature of signed_text. plain_text is the verified plain text.
  • None if public_key fails to verify the signature of signed_text.
OCaml

Innovation. Community. Security.