Module Jose.Header

type t = {
  1. alg : Jwa.alg;
    (*

    Algorithm Header Parameter (RFC 7515 §4.1.1, RFC 7516 §4.1.1)

    *)
  2. jwk : Jwk.public Jwk.t option;
    (*

    JSON Web Key Header Parameter (RFC 7515 §4.1.3, RFC 7517)

    *)
  3. kid : string option;
    (*

    Key ID Header Parameter (RFC 7515 §4.1.4, RFC 7517 §4.5)

    *)
  4. epk : Jwk.public Jwk.t option;
    (*

    Ephemeral Public Key Header Parameter (RFC 7518 §4.6.1.1)

    *)
  5. apu : string option;
    (*

    Agreement PartyUInfo Header Parameter (RFC 7518 §4.6.1.2)

    *)
  6. apv : string option;
    (*

    Agreement PartyVInfo Header Parameter (RFC 7518 §4.6.1.3)

    *)
  7. x5t : string option;
    (*

    X.509 Certificate SHA-1 Thumbprint (RFC 7515 §4.1.7, RFC 7517 §4.8)

    *)
  8. x5t256 : string option;
    (*

    X.509 Certificate SHA-256 Thumbprint (RFC 7515 §4.1.8, RFC 7517 §4.9)

    *)
  9. typ : string option;
    (*

    Type Header Parameter (RFC 7515 §4.1.9, RFC 7519 §5.1)

    *)
  10. cty : string option;
    (*

    Content Type Header Parameter (RFC 7515 §4.1.10)

    *)
  11. enc : Jwa.enc option;
    (*

    Encryption Algorithm Header Parameter (RFC 7516 §4.1.2, RFC 7518 §5.1)

    *)
  12. extra : (string * Yojson.Safe.t) list;
    (*

    Additional custom/unregistered header parameters

    *)
}

The header has the following properties:

  • alg Jwa.alg
  • jwk JSON Web Key
  • kid Key ID - We currently always expect this to be there, this can change in the future
  • x5t X.509 Certificate SHA-1 Thumbprint -
  • x5t#S256 X.509 Certificate SHA-256 Thumbprint
  • typ Type
  • cty Content Type Not implemented

Link to RFC

Complete list of registered header parameters

val make_header : ?typ:string -> ?alg:Jwa.alg -> ?enc:Jwa.enc -> ?extra:(string * Yojson.Safe.t) list -> ?jwk_header:bool -> ?epk:Jwk.public Jwk.t -> ?apu:string -> ?apv:string -> Jwk.priv Jwk.t -> t

make_header typ alg enc jwk if alg is not provided it will be derived from jwk. jwk_header decides if the jwk should be put in the header.

val of_string : string -> (t, [> `Msg of string ]) Stdlib.result
val to_string : t -> string
val to_json : t -> Yojson.Safe.t
val of_json : Yojson.Safe.t -> (t, [> `Msg of string ]) Stdlib.result