package ttweetnacl

  1. Overview
  2. Docs

Module Secretbox.Secret_keySource

Secret keys.

Use Secret_key.generate to generate one.

Sourcetype t

The type for secret keys.

Sourceval length : int

length is the byte length of secret keys.

Sourceval generate : unit -> t

generate () generates a random key using Entropy.gather. The function blocks until enough entropy is gathered.

Sourceval equal : t -> t -> bool

equal k k' determines in constant time if k and k' are bytewise equal.

Sourceval of_bytes : Bytes.t -> t

of_bytes b is a secret key from bytes b. Raises Invalid_argument if b's length differs from length.

Sourceval to_bytes : t -> Bytes.t

to_bytes k are the bytes of k.

Sourceval pp : Format.formatter -> t -> unit

pp ppf pk is an unspecified formatter for secret keys.