Comparing version 5.9.6 to 5.10.0
@@ -57,5 +57,2 @@ import { importJWK } from '../key/import.js'; | ||
} | ||
if (candidate && alg === 'EdDSA') { | ||
candidate = jwk.crv === 'Ed25519' || jwk.crv === 'Ed448'; | ||
} | ||
if (candidate) { | ||
@@ -75,2 +72,8 @@ switch (alg) { | ||
break; | ||
case 'Ed25519': | ||
candidate = jwk.crv === 'Ed25519'; | ||
break; | ||
case 'EdDSA': | ||
candidate = jwk.crv === 'Ed25519' || jwk.crv === 'Ed448'; | ||
break; | ||
} | ||
@@ -77,0 +80,0 @@ } |
@@ -13,3 +13,3 @@ import fetchJwks from '../runtime/fetch_jwks.js'; | ||
const NAME = 'jose'; | ||
const VERSION = 'v5.9.6'; | ||
const VERSION = 'v5.10.0'; | ||
USER_AGENT = `${NAME}/${VERSION}`; | ||
@@ -16,0 +16,0 @@ } |
@@ -36,3 +36,3 @@ import { decode as decodeBase64URL } from '../runtime/base64url.js'; | ||
case 'RSA': | ||
if (jwk.oth !== undefined) { | ||
if ('oth' in jwk && jwk.oth !== undefined) { | ||
throw new JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported'); | ||
@@ -39,0 +39,0 @@ } |
@@ -79,2 +79,7 @@ function unusable(name, prop = 'algorithm.name') { | ||
} | ||
case 'Ed25519': { | ||
if (!isAlgorithm(key.algorithm, 'Ed25519')) | ||
throw unusable('Ed25519'); | ||
break; | ||
} | ||
case 'ES256': | ||
@@ -81,0 +86,0 @@ case 'ES384': |
@@ -109,2 +109,6 @@ import crypto, { isCryptoKey } from './webcrypto.js'; | ||
} | ||
case 'Ed25519': | ||
algorithm = { name: 'Ed25519' }; | ||
keyUsages = isPublic ? ['verify'] : ['sign']; | ||
break; | ||
case 'EdDSA': | ||
@@ -111,0 +115,0 @@ algorithm = { name: getNamedCurve(keyData) }; |
@@ -100,2 +100,6 @@ import crypto from './webcrypto.js'; | ||
break; | ||
case 'Ed25519': | ||
algorithm = { name: 'Ed25519' }; | ||
keyUsages = ['sign', 'verify']; | ||
break; | ||
case 'EdDSA': { | ||
@@ -102,0 +106,0 @@ keyUsages = ['sign', 'verify']; |
@@ -64,2 +64,6 @@ import crypto from './webcrypto.js'; | ||
switch (jwk.alg) { | ||
case 'Ed25519': | ||
algorithm = { name: 'Ed25519' }; | ||
keyUsages = jwk.d ? ['sign'] : ['verify']; | ||
break; | ||
case 'EdDSA': | ||
@@ -66,0 +70,0 @@ algorithm = { name: jwk.crv }; |
@@ -21,2 +21,4 @@ import { JOSENotSupported } from '../util/errors.js'; | ||
return { hash, name: 'ECDSA', namedCurve: algorithm.namedCurve }; | ||
case 'Ed25519': | ||
return { name: 'Ed25519' }; | ||
case 'EdDSA': | ||
@@ -23,0 +25,0 @@ return { name: algorithm.name }; |
@@ -61,5 +61,2 @@ "use strict"; | ||
} | ||
if (candidate && alg === 'EdDSA') { | ||
candidate = jwk.crv === 'Ed25519' || jwk.crv === 'Ed448'; | ||
} | ||
if (candidate) { | ||
@@ -79,2 +76,8 @@ switch (alg) { | ||
break; | ||
case 'Ed25519': | ||
candidate = jwk.crv === 'Ed25519'; | ||
break; | ||
case 'EdDSA': | ||
candidate = jwk.crv === 'Ed25519' || jwk.crv === 'Ed448'; | ||
break; | ||
} | ||
@@ -81,0 +84,0 @@ } |
@@ -17,3 +17,3 @@ "use strict"; | ||
const NAME = 'jose'; | ||
const VERSION = 'v5.9.6'; | ||
const VERSION = 'v5.10.0'; | ||
USER_AGENT = `${NAME}/${VERSION}`; | ||
@@ -20,0 +20,0 @@ } |
@@ -42,3 +42,3 @@ "use strict"; | ||
case 'RSA': | ||
if (jwk.oth !== undefined) { | ||
if ('oth' in jwk && jwk.oth !== undefined) { | ||
throw new errors_js_1.JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported'); | ||
@@ -45,0 +45,0 @@ } |
@@ -83,2 +83,7 @@ "use strict"; | ||
} | ||
case 'Ed25519': { | ||
if (!isAlgorithm(key.algorithm, 'Ed25519')) | ||
throw unusable('Ed25519'); | ||
break; | ||
} | ||
case 'ES256': | ||
@@ -85,0 +90,0 @@ case 'ES384': |
@@ -20,2 +20,3 @@ "use strict"; | ||
return 'sha512'; | ||
case 'Ed25519': | ||
case 'EdDSA': | ||
@@ -22,0 +23,0 @@ return undefined; |
@@ -68,2 +68,4 @@ "use strict"; | ||
return generate('ec', { namedCurve: 'P-521' }); | ||
case 'Ed25519': | ||
return generate('ed25519'); | ||
case 'EdDSA': { | ||
@@ -70,0 +72,0 @@ switch (options?.crv) { |
@@ -48,2 +48,7 @@ "use strict"; | ||
switch (alg) { | ||
case 'Ed25519': | ||
if (asymmetricKeyType !== 'ed25519') { | ||
throw new TypeError(`Invalid key for this operation, its asymmetricKeyType must be ed25519`); | ||
} | ||
break; | ||
case 'EdDSA': | ||
@@ -50,0 +55,0 @@ if (!['ed25519', 'ed448'].includes(asymmetricKeyType)) { |
@@ -58,5 +58,2 @@ import { importJWK } from '../key/import.js'; | ||
} | ||
if (candidate && alg === 'EdDSA') { | ||
candidate = jwk.crv === 'Ed25519' || jwk.crv === 'Ed448'; | ||
} | ||
if (candidate) { | ||
@@ -76,2 +73,8 @@ switch (alg) { | ||
break; | ||
case 'Ed25519': | ||
candidate = jwk.crv === 'Ed25519'; | ||
break; | ||
case 'EdDSA': | ||
candidate = jwk.crv === 'Ed25519' || jwk.crv === 'Ed448'; | ||
break; | ||
} | ||
@@ -78,0 +81,0 @@ } |
@@ -13,3 +13,3 @@ import fetchJwks from '../runtime/fetch_jwks.js'; | ||
const NAME = 'jose'; | ||
const VERSION = 'v5.9.6'; | ||
const VERSION = 'v5.10.0'; | ||
USER_AGENT = `${NAME}/${VERSION}`; | ||
@@ -16,0 +16,0 @@ } |
@@ -36,3 +36,3 @@ import { decode as decodeBase64URL } from '../runtime/base64url.js'; | ||
case 'RSA': | ||
if (jwk.oth !== undefined) { | ||
if ('oth' in jwk && jwk.oth !== undefined) { | ||
throw new JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported'); | ||
@@ -39,0 +39,0 @@ } |
@@ -79,2 +79,7 @@ function unusable(name, prop = 'algorithm.name') { | ||
} | ||
case 'Ed25519': { | ||
if (!isAlgorithm(key.algorithm, 'Ed25519')) | ||
throw unusable('Ed25519'); | ||
break; | ||
} | ||
case 'ES256': | ||
@@ -81,0 +86,0 @@ case 'ES384': |
@@ -17,2 +17,3 @@ import { JOSENotSupported } from '../util/errors.js'; | ||
return 'sha512'; | ||
case 'Ed25519': | ||
case 'EdDSA': | ||
@@ -19,0 +20,0 @@ return undefined; |
@@ -64,2 +64,4 @@ import { createSecretKey, generateKeyPair as generateKeyPairCb } from 'node:crypto'; | ||
return generate('ec', { namedCurve: 'P-521' }); | ||
case 'Ed25519': | ||
return generate('ed25519'); | ||
case 'EdDSA': { | ||
@@ -66,0 +68,0 @@ switch (options?.crv) { |
@@ -45,2 +45,7 @@ import { constants, KeyObject } from 'node:crypto'; | ||
switch (alg) { | ||
case 'Ed25519': | ||
if (asymmetricKeyType !== 'ed25519') { | ||
throw new TypeError(`Invalid key for this operation, its asymmetricKeyType must be ed25519`); | ||
} | ||
break; | ||
case 'EdDSA': | ||
@@ -47,0 +52,0 @@ if (!['ed25519', 'ed448'].includes(asymmetricKeyType)) { |
@@ -99,12 +99,2 @@ /** | ||
dq: string | ||
/** | ||
* RSA JWK "oth" (Other Primes Info) Parameter | ||
* | ||
* This parameter is not supported | ||
*/ | ||
oth?: Array<{ | ||
d?: string | ||
r?: string | ||
t?: string | ||
}> | ||
/** RSA JWK "p" (First Prime Factor) Parameter */ | ||
@@ -158,12 +148,2 @@ p: string | ||
n?: string | ||
/** | ||
* Private RSA JWK "oth" (Other Primes Info) Parameter | ||
* | ||
* This parameter is not supported | ||
*/ | ||
oth?: Array<{ | ||
d?: string | ||
r?: string | ||
t?: string | ||
}> | ||
/** Private RSA JWK "p" (First Prime Factor) Parameter */ | ||
@@ -504,6 +484,9 @@ p?: string | ||
/** | ||
* Expected clock tolerance | ||
* Clock skew tolerance | ||
* | ||
* - In seconds when number (e.g. 5) | ||
* - Parsed as seconds when a string (e.g. "5 seconds", "10 minutes", "2 hours"). | ||
* - Resolved into a number of seconds when a string (e.g. "5 seconds", "10 minutes", "2 hours"). | ||
* | ||
* Used when validating the JWT "nbf" (Not Before) and "exp" (Expiration Time) claims, and when | ||
* validating the "iat" (Issued At) claim if the {@link maxTokenAge `maxTokenAge` option} is set. | ||
*/ | ||
@@ -523,3 +506,3 @@ clockTolerance?: string | number | ||
* - In seconds when number (e.g. 5) | ||
* - Parsed as seconds when a string (e.g. "5 seconds", "10 minutes", "2 hours"). | ||
* - Resolved into a number of seconds when a string (e.g. "5 seconds", "10 minutes", "2 hours"). | ||
* | ||
@@ -549,9 +532,7 @@ * This option makes the JWT "iat" (Issued At) Claim presence required. | ||
* Array of required Claim Names that must be present in the JWT Claims Set. Default is that: if | ||
* the {@link JWTClaimVerificationOptions.issuer `issuer` option} is set, then JWT "iss" (Issuer) | ||
* Claim must be present; if the {@link JWTClaimVerificationOptions.audience `audience` option} is | ||
* set, then JWT "aud" (Audience) Claim must be present; if the | ||
* {@link JWTClaimVerificationOptions.subject `subject` option} is set, then JWT "sub" (Subject) | ||
* Claim must be present; if the | ||
* {@link JWTClaimVerificationOptions.maxTokenAge `maxTokenAge` option} is set, then JWT "iat" | ||
* (Issued At) Claim must be present. | ||
* the {@link issuer `issuer` option} is set, then JWT "iss" (Issuer) Claim must be present; if the | ||
* {@link audience `audience` option} is set, then JWT "aud" (Audience) Claim must be present; if | ||
* the {@link subject `subject` option} is set, then JWT "sub" (Subject) Claim must be present; if | ||
* the {@link maxTokenAge `maxTokenAge` option} is set, then JWT "iat" (Issued At) Claim must be | ||
* present. | ||
*/ | ||
@@ -558,0 +539,0 @@ requiredClaims?: string[] |
{ | ||
"name": "jose", | ||
"version": "5.9.6", | ||
"version": "5.10.0", | ||
"description": "JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -8,5 +8,5 @@ # jose | ||
<picture> | ||
<source media="(prefers-color-scheme: dark)" srcset="./sponsor/Auth0byOkta_dark.png"> | ||
<source media="(prefers-color-scheme: light)" srcset="./sponsor/Auth0byOkta_light.png"> | ||
<img height="65" align="left" alt="Auth0 by Okta" src="./sponsor/Auth0byOkta_light.png"> | ||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/panva/jose/HEAD/sponsor/Auth0byOkta_dark.png"> | ||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/panva/jose/HEAD/sponsor/Auth0byOkta_light.png"> | ||
<img height="65" align="left" alt="Auth0 by Okta" src="https://raw.githubusercontent.com/panva/jose/HEAD/sponsor/Auth0byOkta_light.png"> | ||
</picture> | ||
@@ -29,2 +29,3 @@ | ||
**`example`** ESM import | ||
```js | ||
@@ -35,2 +36,3 @@ import * as jose from 'jose' | ||
**`example`** CJS require | ||
```js | ||
@@ -113,2 +115,3 @@ const jose = require('jose') | ||
The following runtimes are supported _(this is not an exhaustive list)_: | ||
- [Bun](https://github.com/panva/jose/issues/471) | ||
@@ -126,7 +129,7 @@ - [Browsers](https://github.com/panva/jose/issues/263) | ||
| Version | Security Fixes 🔑 | Other Bug Fixes 🐞 | New Features ⭐ | | ||
| ------- | --------- | -------- | -------- | | ||
| [v5.x](https://github.com/panva/jose/tree/v5.x) | ✅ | ✅ | ✅ | | ||
| [v4.x](https://github.com/panva/jose/tree/v4.x) | ✅ | ❌ | ❌ | | ||
| [v2.x](https://github.com/panva/jose/tree/v2.x) | ✅ | ❌ | ❌ | | ||
| Version | Security Fixes 🔑 | Other Bug Fixes 🐞 | New Features ⭐ | | ||
| ----------------------------------------------- | ----------------- | ------------------ | --------------- | | ||
| [v5.x](https://github.com/panva/jose/tree/v5.x) | ✅ | ✅ | ✅ | | ||
| [v4.x](https://github.com/panva/jose/tree/v4.x) | ✅ | ❌ | ❌ | | ||
| [v2.x](https://github.com/panva/jose/tree/v2.x) | ✅ | ❌ | ❌ | | ||
@@ -151,5 +154,4 @@ ## Specifications | ||
</details> | ||
[sponsor-auth0]: https://auth0.com/signup?utm_source=external_sites&utm_medium=panva&utm_campaign=devn_signup | ||
[sponsor-auth0]: https://a0.to/signup/panva |
552320
13361
152