npm / jose
jose
What changed in jose 5 to 6, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
54 breaking10 security8 new APIs and options2 behavior and defaults2 tooling31 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initjose 695 changes
Breaking changes 46
Direct AKP key inputs now require alg.
Negative maxTokenAge values are now rejected.
Mixed b64 modes are rejected for empty General JWS payloads.
Mixed payload encoding modes are rejected.
Empty protected headers and JWE AAD members are rejected.
Verification key metadata is enforced.
JWT verification policies must be explicit.
EmbeddedJWK now rejects a non-string alg value.
Decryption now enforces a single recipient for dir and ECDH-ES algorithms.
Presence checks now require properties owned by the JOSE object.
Truncated ASN.1 key data is rejected.
Characters outside the Base64URL alphabet are rejected.
Duplicate crit values are rejected when producing JOSE objects.
Rejects a crv option that is not implied by the selected algorithm.
Invalid UTF-8 is rejected in JOSE Headers and JWT Claims Sets.
Unencoded payloads are rejected when using JWS Compact Serialization.
Non-ASCII token segments now produce JOSE errors.
Failed decompression is now rejected with a JWEInvalid error.
CJS-style require works only when the Node.js runtime supports require(esm).
The Node.js-only agent option has been removed because createRemoteJWKSet now uses fetch.
The deriveKey usage is no longer supported.
The (un)wrapKey usage is no longer supported.
Deprecated experimental APIs have been removed.
Support for Ed448 has been dropped.
All builds and bundles now target ES2022.
In Node.js, generateKeyPair now yields a CryptoKey instead of a KeyObject.
In Node.js, generateSecret now yields a CryptoKey instead of a KeyObject.
In Node.js, importJWK now yields a CryptoKey instead of a KeyObject.
In Node.js, importPKCS8 now yields a CryptoKey instead of a KeyObject.
In Node.js, importSPKI now yields a CryptoKey instead of a KeyObject.
In Node.js, importX509 now yields a CryptoKey instead of a KeyObject.
The runtime-specific package is no longer maintained or supported.
The runtime-specific package is no longer maintained or supported.
The extractable default for public keys imported from JWK is now true.
Support for JWK key_ops has been dropped.
Key Type Generics have been removed.
PEMImportOptions has been renamed to KeyImportOptions, so update type references.
Node.js 18.x and earlier are no longer supported.
The extractable default for public keys imported from PEM is now true.
Private KeyObject instances can no longer be used for verify operations.
Private KeyObject instances can no longer be used for encryption operations.
Keys returned by verify/decrypt operations using get key functions are always normalized to Uint8Array or CryptoKey, depending on the operation.
RSA1_5 JWE support has been removed.
secp256k1 JWS support has been removed.
WebCryptoAPI is now the only crypto used.
Support for X448 has been dropped.
Security 10
Negative JWT clockTolerance values are rejected.
JWE decompression is canceled when output exceeds the limit.
AES-GCM tag boundaries are enforced.
DER truncated past its outer length is rejected.
The ext and key_ops parameters are validated.
Protected headers cannot be replaced.
Unencoded payload strings are validated.
Unsecured protected headers are validated.
JWE objects with colliding generated Key Management Parameters are now rejected.
Invalid PBES2 p2c values are now cleanly rejected.
New APIs and options 5
Discriminated JOSE error types are available for more precise TypeScript error handling.
Re-introduces support for the JWE zip (Compression Algorithm) Header Parameter.
setKeyManagementParameters is now exposed on a GeneralEncrypt Recipient.
New fetch-related options are available now that createRemoteJWKSet uses fetch.
JSON Web Key is now an allowed input everywhere.
Behavior and default changes 1
CryptoKey and KeyObject inputs are now enabled in JWK thumbprint functions.
Tooling 2
JOSE identifier unions and JWK narrowing improve TypeScript type precision.
JWK narrowing improves TypeScript type precision.
Fixes and other changes 31
JWT handling now accepts mixed-case ago suffixes.
Headers are preserved when claims are replicated.
Errors are preserved when compression streams are unavailable.
Timeouts while reading the response body are now reported.
Invalid options are now exposed in general JWS and JWE.
Negative JWKS cache durations are rejected.
Preserves contextual inference for JWT payloads, so TypeScript can retain payload types in context.
Underlying error causes are now preserved, allowing developers to retain the original cause when handling errors.
Builder claim values are validated.
Invalid decrypted CEK lengths are concealed.
Invalid duration inputs are rejected.
Explicit encryption parameters are validated.
Key generation and import options are validated.
Key resolution inputs are normalized.
Empty octet-sequence keys are accepted.
Invalid remote duration values are rejected.
Overlapping remote reloads are ordered.
Serialization members are consumed only once.
Serialized header values are validated.
The PBES2 p2c parameter is no longer deprecated in the type definitions.
Type declarations now accept host CryptoKey declarations.
The clockTolerance option is validated to ensure it is finite.
CryptoKey types are corrected for more accurate TypeScript usage.
The currentDate option is validated to ensure it is finite.
Claim values are compared correctly when validation options are falsy.
JWE processing now handles additional authenticated data with zero length.
Key management parameters are forwarded correctly when a JWE has a single recipient.
JWK types are corrected for more accurate TypeScript usage.
JWT header types are corrected for more accurate TypeScript usage.
Key and result type inference is improved for TypeScript consumers.
Key resolver types are corrected for more accurate TypeScript usage.
jose 512 changes
Breaking changes 8
In Node.js, base64url.decode returns a Uint8Array instead of a Buffer.
The browser distribution is now built using ES2020 as a target.
For oct JWK key types, importJWK always returns a Uint8Array formed from the k parameter, regardless of other JWK parameters.
JWT producing constructors now default to an empty payload.
Decrypt functions now require the keyManagementAlgorithms option to explicitly opt in to using PBES2 key management algorithms.
End-of-Life Node.js versions are no longer supported; Node.js 18, 20, 21, and future releases remain supported.
The importJWK option was removed; importJWK no longer returns CryptoKey or KeyObject for oct JWKs.
The JWE zip compression header parameter is no longer supported.
New APIs and options 3
jwtDecrypt has an optional KeyLike resolved type argument as a second type argument, following the JWT Claims Set type.
jwtVerify has an optional KeyLike resolved type argument as a second type argument, following the JWT Claims Set type.
Timestamp setting functions now accept Date as valid input.
Behavior and default changes 1
The Node.js distribution is now built using ES2022 as a target.