Module Webs_authenticatable.Secret_key

Secret keys.

type t = [
  1. | `Hs256 of string
    (*

    Used with HMAC-SHA-256, hence should be at least 32 bytes.

    *)
]

The type for secret keys. This defines both a key and a corresponding authentification scheme.

val random_hs256 : ?crypto_random:Webs_crypto_random.t -> unit -> t

random_hs256 () are 64 random bytes sourced from the generator crypto_random (defaults to Webs_crypto_random.get).

val to_ascii_string : t -> string

to_ascii_string k encodes k to an URL safe US-ASCII scheme that can be read back by of_ascii_string.

val of_ascii_string : string -> (t, string) Stdlib.result

of_ascii_string s reads back the encoding of to_ascii_string.