package jose

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Link to RFC

type t = {
  1. header : Header.t;
  2. cek : string;
    (*

    Content Encryption Key

    *)
  3. iv : string;
    (*

    Initialization Vector

    *)
  4. payload : string;
    (*

    plaintext to be encrypted

    *)
  5. aad : string option;
    (*

    Additional Authentication Data, for future use

    *)
}

A JWE ready for encryption

val make : header:Header.t -> string -> (t, [> `Missing_enc | `Unsupported_alg ]) Stdlib.result

make header payload creates a JWE from a Header.t and the plaintext that you want to encrypt

val encrypt : jwk:'a Jwk.t -> t -> (string, [> `Invalid_alg | `Missing_enc | `Unsupported_enc | `Unsupported_kty ]) Stdlib.result

encrypt jwk t encrypts a t into the compact string format

val decrypt : jwk:Jwk.priv Jwk.t -> string -> (t, [> `Invalid_JWE | `Invalid_JWK | `Decrypt_cek_failed | `Msg of string ]) Stdlib.result

decrypt jwk string decrypts a compact string formated JWE into a t

OCaml

Innovation. Community. Security.