Skip to main content

@panva/jose@6.0.10
Built and signed on GitHub Actions

JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
94%
Published
2 weeks ago (6.0.10)
N
base64url

Base64URL encoding and decoding utilities

I
CompactDecryptResult

Compact JWE decryption result

I
CompactJWEHeaderParameters

Recognized Compact JWE Header Parameters, any other Header Members may also be present.

I
CompactJWSHeaderParameters

Recognized Compact JWS Header Parameters, any other Header Members may also be present.

I
CompactVerifyResult

Compact JWS verification result

I
CritOption

Shared Interface with a "crit" property for all sign, verify, encrypt and decrypt operations.

T
CryptoKey

!CryptoKey is a representation of a key/secret available in all supported runtimes. In addition to the Key Import Functions you may use the !SubtleCrypto.importKey API to obtain a !CryptoKey from your existing key material.

I
EncryptOptions

JWE Encryption options.

N
errors

JOSE module errors and error codes

I
FlattenedJWE

Flattened JWE JSON Serialization Syntax token.

I
FlattenedJWS

Flattened JWS JSON Serialization Syntax token. Payload is returned as an empty string when JWS Unencoded Payload (RFC7797) is used.

I
FlattenedJWSInput

Flattened JWS definition for verify function inputs, allows payload as !Uint8Array for detached signature validation.

I
FlattenedVerifyResult

Flattened JWS JSON Serialization Syntax verification result

I
GeneralDecryptResult

General JWE JSON Serialization Syntax decryption result

I
GeneralJWE

General JWE JSON Serialization Syntax token.

I
GeneralJWS

General JWS JSON Serialization Syntax token. Payload is returned as an empty string when JWS Unencoded Payload (RFC7797) is used.

I
GeneralJWSInput

General JWS definition for verify function inputs, allows payload as !Uint8Array for detached signature validation.

I
GeneralVerifyResult

General JWS JSON Serialization Syntax verification result

I
GetKeyFunction

Generic Interface for consuming operations dynamic key resolution.

I
JoseHeaderParameters

Header Parameters common to JWE and JWS

I
JSONWebKeySet

JSON Web Key Set

I
JWEHeaderParameters

Recognized JWE Header Parameters, any other Header members may also be present.

I
JWEKeyManagementHeaderParameters

Recognized JWE Key Management-related Header Parameters.

I
JWK

JSON Web Key (JWK). "RSA", "EC", "OKP", and "oct" key types are supported.

I
JWK_EC_Private

Convenience interface for Private EC JSON Web Keys

I
JWK_EC_Public

Convenience interface for Public EC JSON Web Keys

I
JWK_oct

Convenience interface for oct JSON Web Keys

I
JWK_OKP_Private

Convenience interface for Private OKP JSON Web Keys

I
JWK_OKP_Public

Convenience interface for Public OKP JSON Web Keys

I
JWK_RSA_Private

Convenience interface for Private RSA JSON Web Keys

I
JWK_RSA_Public

Convenience interface for Public RSA JSON Web Keys

I
JWKParameters

Generic JSON Web Key Parameters.

I
JWSHeaderParameters

Recognized JWS Header Parameters, any other Header Members may also be present.

I
JWTDecryptResult

Encrypted JSON Web Token (JWT) decryption result

I
JWTHeaderParameters

Recognized Signed JWT Header Parameters, any other Header Members may also be present.

I
JWTPayload

Recognized JWT Claims Set members, any other members may also be present.

I
JWTVerifyResult

Signed JSON Web Token (JWT) verification result

I
KeyObject

!KeyObject is a representation of a key/secret available in the Node.js runtime. You may use the Node.js runtime APIs !createPublicKey, !createPrivateKey, and !createSecretKey to obtain a !KeyObject from your existing key material.

I
ResolvedKey

When key resolver functions are used this becomes part of successful resolves

I
SignOptions

JWS Signing options.

I
VerifyOptions

JWS Verification options.

v
cryptoRuntime

In prior releases this indicated whether a Node.js-specific build was loaded, this is now fixed to "WebCryptoAPI"

base64url

Base64URL encoding and decoding utilities

f
base64url.decode

Decodes a Base64URL encoded input.

f
base64url.encode

Encodes an input using Base64URL with no padding.

f
decode

Decodes a Base64URL encoded input.

f
encode

Encodes an input using Base64URL with no padding.

decode/protected_header

JOSE Protected Header Decoding (JWE, JWS, all serialization syntaxes)

f
decodeProtectedHeader

Decodes the Protected Header of a JWE/JWS/JWT token utilizing any JOSE serialization.

T
ProtectedHeaderParameters

JWE and JWS Header Parameters

errors

JOSE module errors and error codes

c
errors.JOSEAlgNotAllowed

An error subclass thrown when a JOSE Algorithm is not allowed per developer preference.

c
errors.JOSEError

A generic Error that all other JOSE specific Error subclasses extend.

c
errors.JOSENotSupported

An error subclass thrown when a particular feature or algorithm is not supported by this implementation or JOSE in general.

c
errors.JWEDecryptionFailed

An error subclass thrown when a JWE ciphertext decryption fails.

c
errors.JWEInvalid

An error subclass thrown when a JWE is invalid.

c
errors.JWKInvalid

An error subclass thrown when a JWK is invalid.

c
errors.JWKSInvalid

An error subclass thrown when a JWKS is invalid.

c
errors.JWKSMultipleMatchingKeys

An error subclass thrown when multiple keys match from a JWKS.

c
errors.JWKSNoMatchingKey

An error subclass thrown when no keys match from a JWKS.

c
errors.JWKSTimeout

Timeout was reached when retrieving the JWKS response.

c
errors.JWSInvalid

An error subclass thrown when a JWS is invalid.

c
errors.JWSSignatureVerificationFailed

An error subclass thrown when JWS signature verification fails.

c
errors.JWTClaimValidationFailed

An error subclass thrown when a JWT Claim Set member validation fails.

c
errors.JWTExpired

An error subclass thrown when a JWT is expired.

c
errors.JWTInvalid

An error subclass thrown when a JWT is invalid.

c
JOSEAlgNotAllowed

An error subclass thrown when a JOSE Algorithm is not allowed per developer preference.

c
JOSEError

A generic Error that all other JOSE specific Error subclasses extend.

c
JOSENotSupported

An error subclass thrown when a particular feature or algorithm is not supported by this implementation or JOSE in general.

c
JWEDecryptionFailed

An error subclass thrown when a JWE ciphertext decryption fails.

c
JWEInvalid

An error subclass thrown when a JWE is invalid.

c
JWKInvalid

An error subclass thrown when a JWK is invalid.

c
JWKSInvalid

An error subclass thrown when a JWKS is invalid.

c
JWKSMultipleMatchingKeys

An error subclass thrown when multiple keys match from a JWKS.

c
JWKSNoMatchingKey

An error subclass thrown when no keys match from a JWKS.

c
JWKSTimeout

Timeout was reached when retrieving the JWKS response.

c
JWSInvalid

An error subclass thrown when a JWS is invalid.

c
JWSSignatureVerificationFailed

An error subclass thrown when JWS signature verification fails.

c
JWTClaimValidationFailed

An error subclass thrown when a JWT Claim Set member validation fails.

c
JWTExpired

An error subclass thrown when a JWT is expired.

c
JWTInvalid

An error subclass thrown when a JWT is invalid.

jwe/compact/decrypt

Decrypting JSON Web Encryption (JWE) in Compact Serialization

f
compactDecrypt

Decrypts a Compact JWE.

I
CompactDecryptGetKey

Interface for Compact JWE Decryption dynamic key resolution. No token components have been verified at the time of this function call.

jwe/compact/encrypt

Encrypting JSON Web Encryption (JWE) in Compact Serialization

c
CompactEncrypt

The CompactEncrypt class is used to build and encrypt Compact JWE strings.

jwe/flattened/decrypt

Decrypting JSON Web Encryption (JWE) in Flattened JSON Serialization

f
flattenedDecrypt

Decrypts a Flattened JWE.

I
FlattenedDecryptGetKey

Interface for Flattened JWE Decryption dynamic key resolution. No token components have been verified at the time of this function call.

jwe/flattened/encrypt

Encrypting JSON Web Encryption (JWE) in Flattened JSON Serialization

jwe/general/decrypt

Decrypting JSON Web Encryption (JWE) in General JSON Serialization

f
generalDecrypt

Decrypts a General JWE.

I
GeneralDecryptGetKey

Interface for General JWE Decryption dynamic key resolution. No token components have been verified at the time of this function call.

jwe/general/encrypt

Encrypting JSON Web Encryption (JWE) in General JSON Serialization

c
GeneralEncrypt

The GeneralEncrypt class is used to build and encrypt General JWE objects.

I
Recipient

Used to build General JWE object's individual recipients.

jwk/embedded

Verification using a JWK Embedded in a JWS Header

f
EmbeddedJWK

EmbeddedJWK is an implementation of a GetKeyFunction intended to be used with the JWS/JWT verify operations whenever you need to opt-in to verify signatures with a public key embedded in the token's "jwk" (JSON Web Key) Header Parameter. It is recommended to combine this with the verify function's algorithms option to define accepted JWS "alg" (Algorithm) Header Parameter values.

jwk/thumbprint

JSON Web Key Thumbprint and JSON Web Key Thumbprint URI

f
calculateJwkThumbprint

Calculates a base64url-encoded JSON Web Key (JWK) Thumbprint

f
calculateJwkThumbprintUri

Calculates a JSON Web Key (JWK) Thumbprint URI

jwks/local

Verification using a JSON Web Key Set (JWKS) available locally

f
createLocalJWKSet

Returns a function that resolves a JWS JOSE Header to a public key object from a locally stored, or otherwise available, JSON Web Key Set.

jwks/remote

Verification using a JSON Web Key Set (JWKS) available on an HTTP(S) URL

f
createRemoteJWKSet

Returns a function that resolves a JWS JOSE Header to a public key object downloaded from a remote endpoint returning a JSON Web Key Set, that is, for example, an OAuth 2.0 or OIDC jwks_uri. The JSON Web Key Set is fetched when no key matches the selection process but only as frequently as the cooldownDuration option allows to prevent abuse.

v
customFetch

When passed to createRemoteJWKSet this allows the resolver to make use of advanced fetch configurations, HTTP Proxies, retry on network errors, etc.

I
ExportedJWKSCache

See jwksCache.

T
FetchImplementation

See customFetch.

v
jwksCache

DANGER ZONE - This option has security implications that must be understood, assessed for applicability, and accepted before use. It is critical that the JSON Web Key Set cache only be writable by your own code.

T
JWKSCacheInput

See jwksCache.

jws/compact/sign

Signing JSON Web Signature (JWS) in Compact Serialization

c
CompactSign

The CompactSign class is used to build and sign Compact JWS strings.

jws/compact/verify

Verifying JSON Web Signature (JWS) in Compact Serialization

f
compactVerify

Verifies the signature and format of and afterwards decodes the Compact JWS.

I
CompactVerifyGetKey

Interface for Compact JWS Verification dynamic key resolution. No token components have been verified at the time of this function call.

jws/flattened/sign

Signing JSON Web Signature (JWS) in Flattened JSON Serialization

c
FlattenedSign

The FlattenedSign class is used to build and sign Flattened JWS objects.

jws/flattened/verify

Verifying JSON Web Signature (JWS) in Flattened JSON Serialization

f
flattenedVerify

Verifies the signature and format of and afterwards decodes the Flattened JWS.

I
FlattenedVerifyGetKey

Interface for Flattened JWS Verification dynamic key resolution. No token components have been verified at the time of this function call.

jws/general/sign

Signing JSON Web Signature (JWS) in General JSON Serialization

c
GeneralSign

The GeneralSign class is used to build and sign General JWS objects.

I
Signature

Used to build General JWS object's individual signatures.

jws/general/verify

Verifying JSON Web Signature (JWS) in General JSON Serialization

f
generalVerify

Verifies the signature and format of and afterwards decodes the General JWS.

I
GeneralVerifyGetKey

Interface for General JWS Verification dynamic key resolution. No token components have been verified at the time of this function call.

jwt/decode

JSON Web Token (JWT) Claims Set Decoding (no validation, no signature checking)

f
decodeJwt

Decodes a signed JSON Web Token payload. This does not validate the JWT Claims Set types or values. This does not validate the JWS Signature. For a proper Signed JWT Claims Set validation and JWS signature verification use jose.jwtVerify(). For an encrypted JWT Claims Set validation and JWE decryption use jose.jwtDecrypt().

jwt/decrypt

JSON Web Token (JWT) Decryption (JWT is in JWE format)

f
jwtDecrypt

Verifies the JWT format (to be a JWE Compact format), decrypts the ciphertext, validates the JWT Claims Set.

I
JWTDecryptGetKey

Interface for JWT Decryption dynamic key resolution. No token components have been verified at the time of this function call.

I
JWTDecryptOptions

Combination of JWE Decryption options and JWT Claims Set verification options.

jwt/encrypt

JSON Web Token (JWT) Encryption (JWT is in JWE format)

jwt/sign

JSON Web Token (JWT) Signing (JWT is in JWS format)

c
SignJWT

The SignJWT class is used to build and sign Compact JWS formatted JSON Web Tokens.

jwt/unsecured

Unsecured (unsigned & unencrypted) JSON Web Tokens (JWT)

c
UnsecuredJWT

The UnsecuredJWT class is a utility for dealing with { "alg": "none" } Unsecured JWTs.

I
UnsecuredResult

Result of decoding an Unsecured JWT.

jwt/verify

JSON Web Token (JWT) Verification (JWT is in JWS format)

f
jwtVerify

Verifies the JWT format (to be a JWS Compact format), verifies the JWS signature, validates the JWT Claims Set.

I
JWTVerifyGetKey

Interface for JWT Verification dynamic key resolution. No token components have been verified at the time of this function call.

I
JWTVerifyOptions

Combination of JWS Verification options and JWT Claims Set verification options.

key/export

Cryptographic key export functions

f
exportJWK

Exports a !CryptoKey, !KeyObject, or !Uint8Array to a JWK.

f
exportPKCS8

Exports a private !CryptoKey or !KeyObject to a PEM-encoded PKCS8 string format.

f
exportSPKI

Exports a public !CryptoKey or !KeyObject to a PEM-encoded SPKI string format.

key/generate/keypair

Asymmetric key generation

f
generateKeyPair

Generates a private and a public key for a given JWA algorithm identifier. This can only generate asymmetric key pairs. For symmetric secrets use the generateSecret function.

I
GenerateKeyPairOptions

Asymmetric key pair generation function options.

I
GenerateKeyPairResult

Asymmetric key pair generation function result.

key/generate/secret

Symmetric key generation

f
generateSecret

Generates a symmetric secret key for a given JWA algorithm identifier.

I
GenerateSecretOptions

Secret generation function options.

key/import

Cryptographic key import functions

f
importJWK

Imports a JWK to a !CryptoKey. Either the JWK "alg" (Algorithm) Parameter, or the optional "alg" argument, must be present for asymmetric JSON Web Key imports.

f
importPKCS8

Imports a PEM-encoded PKCS#8 string as a !CryptoKey.

f
importSPKI

Imports a PEM-encoded SPKI string as a !CryptoKey.

f
importX509

Imports the SPKI from an X.509 string certificate as a !CryptoKey.

I
KeyImportOptions

Key Import Function options.