Module Webs_authenticatable.Private_key

Private keys.

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

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

    *)
]

The type for private keys. This defines both a key and a correspoding authentification scheme.

val random_hs256 : ?random_state:Stdlib.Random.State.t -> unit -> t

random_hs256 () are 64 random bytes sourced from the given PRNG state (defaults to Stdlib.Random.make_self_init).

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

private_key_of_ascii_string s reads back the encoding of to_ascii_string.