Module Jws.JwkSource

Asymmetric public keys. This type is a subset of X509.Public_key.t: any X509.Public_key.t value whose algorithm is supported can be injected via of_public_key.

Sourcetype t = [
  1. | p
  2. | `Oct of string
]

Public keys and symmetric (oct) keys.

Sourceval encode : t -> string

encode key is the JSON serialization of key as a JWK.

Sourceval decode : string -> (t, [> `Msg of string ]) result

decode str parses a JWK from its JSON serialization. Returns a descriptive error when the JSON is malformed, the key type is unknown, or the key parameters are invalid.

A Jsont.t codec for JWK values. Can be used with Jsont_bytesrw.decode_string or composed into larger Jsont descriptions.

Sourceval algorithm : t -> Jwa.t

algorithm p is the default Jwa.t algorithm for the given public key p.

Sourceval verify : ?alg:Jwa.t -> t -> string -> string -> bool

verify ?alg p data signature is true iff signature is a valid signature of data under the given public key p with algorithm alg (defaults to the default algorithm of the given p (see algorithm)).

Sourceval of_public_key : [> p ] -> (t, [> `Msg of string ]) result

of_public_key pk converts an X509.Public_key.t value to a t. Fails if the key algorithm is not supported.

Sourceval of_public_key_exn : [> p ] -> t

of_public_key_exn p is like of_public_key but raises Invalid_argument on unsupported key types.

Sourceval signature : t -> string