Jwk.ts overview
JSON Web Key (JWK) schemas based on RFC 7517 and RFC 7518 Section 6.
This module provides Effect Schema definitions for representing cryptographic keys as JSON objects, including key-type-specific parameters for EC, RSA, and symmetric (oct) keys, as well as the JWK Set format.
See
- https://www.rfc-editor.org/rfc/rfc7517 - JSON Web Key (JWK)
- https://www.rfc-editor.org/rfc/rfc7518#section-6 - Cryptographic Algorithms for Keys
Since v1.0.0
Exports Grouped by Category
Elliptic Curve
EcPrivateKey (class)
An Elliptic Curve private key represented as a JWK. Extends the public key with the private key parameter “d”.
See
- https://www.rfc-editor.org/rfc/rfc7518#section-6.2.2
Signature
declare class EcPrivateKey
Since v1.0.0
EcPublicKey (class)
An Elliptic Curve public key represented as a JWK.
Members “kty”, “crv”, “x”, and “y” are required for EC public keys.
See
- https://www.rfc-editor.org/rfc/rfc7518#section-6.2.1
Signature
declare class EcPublicKey
Since v1.0.0
EllipticCurve (class)
JWK Curve parameter values for Elliptic Curve keys as defined in RFC 7518 Section 6.2.1.1.
See
- https://www.rfc-editor.org/rfc/rfc7518#section-6.2.1.1
Signature
declare class EllipticCurve
Since v1.0.0
JWK
Jwk
A JSON Web Key (JWK) as defined in RFC 7517. This is a discriminated union over the “kty” field, supporting EC, RSA, and symmetric (oct) key types.
The union includes both public and private key representations — consumers can narrow using the individual schemas (e.g. EcPublicKey, RsaPrivateKey) when a specific key form is expected.
See
- https://www.rfc-editor.org/rfc/rfc7517#section-4
Signature
declare const Jwk: Schema.Union<
[typeof EcPublicKey, typeof EcPrivateKey, typeof RsaPublicKey, typeof RsaPrivateKey, typeof OctKey]
>
Since v1.0.0
JWK Set
JwkSet (class)
A JWK Set as defined in RFC 7517 Section 5. A JSON object that represents a set of JWKs. The “keys” member is required and must be an array of JWKs.
See
- https://www.rfc-editor.org/rfc/rfc7517#section-5
Signature
declare class JwkSet
Since v1.0.0
Key Operations
KeyOperation (class)
JWK Key Operations parameter values as defined in RFC 7517 Section 4.3. These values intentionally match the Web Cryptography API KeyUsage values.
See
- https://www.rfc-editor.org/rfc/rfc7517#section-4.3
Signature
declare class KeyOperation
Since v1.0.0
Key Type
KeyType (class)
JWK “kty” (Key Type) parameter values as defined in RFC 7518 Section 6.1.
See
- https://www.rfc-editor.org/rfc/rfc7518#section-6.1
Signature
declare class KeyType
Since v1.0.0
Key Use
KeyUse (class)
JWK Public Key Use parameter values as defined in RFC 7517 Section 4.2.
See
- https://www.rfc-editor.org/rfc/rfc7517#section-4.2
Signature
declare class KeyUse
Since v1.0.0
RSA
RsaPrivateKey (class)
An RSA private key represented as a JWK. Extends the public key with private key parameters. The “d” parameter is required; the remaining CRT parameters (“p”, “q”, “dp”, “dq”, “qi”) should be included and if any one of them is present then all of them must be present.
See
- https://www.rfc-editor.org/rfc/rfc7518#section-6.3.2
Signature
declare class RsaPrivateKey
Since v1.0.0
RsaPublicKey (class)
An RSA public key represented as a JWK.
Members “kty”, “n”, and “e” are required for RSA public keys.
See
- https://www.rfc-editor.org/rfc/rfc7518#section-6.3.1
Signature
declare class RsaPublicKey
Since v1.0.0
Symmetric
OctKey (class)
A symmetric key (octet sequence) represented as a JWK.
Members “kty” and “k” are required for symmetric keys.
See
- https://www.rfc-editor.org/rfc/rfc7518#section-6.4
Signature
declare class OctKey
Since v1.0.0