package conex

  1. Overview
  2. Docs

The private key module type

type t

The type of a private key

val ids : unit -> Conex_resource.identifier list

ids () is the list of all available private keys.

type r_err = [
  1. | `Decode of string
  2. | `Read of string
  3. | `None
  4. | `Multiple of string list
]
val pp_r_err : r_err Conex_utils.fmt
val read : (float -> Conex_resource.timestamp option) -> Conex_resource.identifier -> (t, r_err) Stdlib.result

read id is either Ok priv, the private key corresponding to id, or an Error.

val bits : t -> int

bits t is the number of bits of the private key t.

val created : t -> Conex_resource.timestamp

created t is the timestamp when t was created.

id t is the identifier of t.

val generate : ?bits:int -> (float -> Conex_resource.timestamp option) -> Conex_resource.Key.alg -> Conex_resource.identifier -> unit -> (t, string) Stdlib.result

generate ~bits alg id () generates a fresh private key using alg for id, or an error. Generate also ensures to persistently store the generated key if desired.

val pub_of_priv : t -> Conex_resource.Key.t

pub_of_priv priv extracts the public key out of priv.

sign wire now id alg priv signs wire with priv using alg, and evaluates to a signature, or an error.

OCaml

Innovation. Community. Security.