gossamer/crypto/jwk

JSON Web Keys (JWK) as defined by RFC 7517. Passed to subtle.import_key_jwk and returned by subtle.export_key_jwk.

Types

A JSON Web Key (JWK), as defined by RFC 7517. Used with subtle.import_key_jwk and subtle.export_key_jwk.

pub type JsonWebKey {
  JsonWebKey(
    kty: option.Option(String),
    use_: option.Option(String),
    key_ops: option.Option(List(crypto.KeyUsage)),
    alg: option.Option(String),
    ext: option.Option(Bool),
    crv: option.Option(String),
    x: option.Option(String),
    y: option.Option(String),
    d: option.Option(String),
    n: option.Option(String),
    e: option.Option(String),
    p: option.Option(String),
    q: option.Option(String),
    dp: option.Option(String),
    dq: option.Option(String),
    qi: option.Option(String),
    k: option.Option(String),
  )
}

Constructors

Values

pub fn new() -> JsonWebKey

Creates a JsonWebKey with all fields set to None.

pub fn set_alg(jwk: JsonWebKey, alg: String) -> JsonWebKey

Sets the algorithm intended for use with the key.

pub fn set_crv(jwk: JsonWebKey, crv: String) -> JsonWebKey

Sets the elliptic curve name for an EC key.

pub fn set_d(jwk: JsonWebKey, d: String) -> JsonWebKey

Sets the private exponent (RSA) or private key value (EC, OKP).

pub fn set_dp(jwk: JsonWebKey, dp: String) -> JsonWebKey

Sets the first factor CRT exponent of an RSA private key.

pub fn set_dq(jwk: JsonWebKey, dq: String) -> JsonWebKey

Sets the second factor CRT exponent of an RSA private key.

pub fn set_e(jwk: JsonWebKey, e: String) -> JsonWebKey

Sets the public exponent of an RSA public key.

pub fn set_ext(jwk: JsonWebKey, ext: Bool) -> JsonWebKey

Sets whether the key is extractable.

pub fn set_k(jwk: JsonWebKey, k: String) -> JsonWebKey

Sets the symmetric key value for an "oct" key.

pub fn set_key_ops(
  jwk: JsonWebKey,
  key_ops: List(crypto.KeyUsage),
) -> JsonWebKey

Sets the operations the key is intended for.

pub fn set_kty(jwk: JsonWebKey, kty: String) -> JsonWebKey

Sets the key type, e.g. "EC", "RSA", or "oct".

pub fn set_n(jwk: JsonWebKey, n: String) -> JsonWebKey

Sets the modulus of an RSA public key.

pub fn set_p(jwk: JsonWebKey, p: String) -> JsonWebKey

Sets the first prime factor of an RSA private key.

pub fn set_q(jwk: JsonWebKey, q: String) -> JsonWebKey

Sets the second prime factor of an RSA private key.

pub fn set_qi(jwk: JsonWebKey, qi: String) -> JsonWebKey

Sets the first CRT coefficient of an RSA private key.

pub fn set_use(jwk: JsonWebKey, use_: String) -> JsonWebKey

Sets the intended use of the public key, e.g. "sig" or "enc".

pub fn set_x(jwk: JsonWebKey, x: String) -> JsonWebKey

Sets the x coordinate of an EC public key.

pub fn set_y(jwk: JsonWebKey, y: String) -> JsonWebKey

Sets the y coordinate of an EC public key.

Search Document