jose 5.1.1 → 5.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/jwks/remote.js +1 -1
- package/dist/browser/lib/jwt_claims_set.js +6 -5
- package/dist/node/cjs/jwks/remote.js +1 -1
- package/dist/node/cjs/lib/jwt_claims_set.js +6 -5
- package/dist/node/esm/jwks/remote.js +1 -1
- package/dist/node/esm/lib/jwt_claims_set.js +6 -5
- package/package.json +19 -1
|
@@ -9,7 +9,7 @@ function isCloudflareWorkers() {
|
|
|
9
9
|
let USER_AGENT;
|
|
10
10
|
if (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozilla/5.0 ')) {
|
|
11
11
|
const NAME = 'jose';
|
|
12
|
-
const VERSION = 'v5.1.
|
|
12
|
+
const VERSION = 'v5.1.3';
|
|
13
13
|
USER_AGENT = `${NAME}/${VERSION}`;
|
|
14
14
|
}
|
|
15
15
|
class RemoteJWKSet extends LocalJWKSet {
|
|
@@ -30,15 +30,16 @@ export default (protectedHeader, encodedPayload, options = {}) => {
|
|
|
30
30
|
throw new JWTInvalid('JWT Claims Set must be a top-level JSON object');
|
|
31
31
|
}
|
|
32
32
|
const { requiredClaims = [], issuer, subject, audience, maxTokenAge } = options;
|
|
33
|
+
const presenceCheck = [...requiredClaims];
|
|
33
34
|
if (maxTokenAge !== undefined)
|
|
34
|
-
|
|
35
|
+
presenceCheck.push('iat');
|
|
35
36
|
if (audience !== undefined)
|
|
36
|
-
|
|
37
|
+
presenceCheck.push('aud');
|
|
37
38
|
if (subject !== undefined)
|
|
38
|
-
|
|
39
|
+
presenceCheck.push('sub');
|
|
39
40
|
if (issuer !== undefined)
|
|
40
|
-
|
|
41
|
-
for (const claim of new Set(
|
|
41
|
+
presenceCheck.push('iss');
|
|
42
|
+
for (const claim of new Set(presenceCheck.reverse())) {
|
|
42
43
|
if (!(claim in payload)) {
|
|
43
44
|
throw new JWTClaimValidationFailed(`missing required "${claim}" claim`, claim, 'missing');
|
|
44
45
|
}
|
|
@@ -12,7 +12,7 @@ function isCloudflareWorkers() {
|
|
|
12
12
|
let USER_AGENT;
|
|
13
13
|
if (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozilla/5.0 ')) {
|
|
14
14
|
const NAME = 'jose';
|
|
15
|
-
const VERSION = 'v5.1.
|
|
15
|
+
const VERSION = 'v5.1.3';
|
|
16
16
|
USER_AGENT = `${NAME}/${VERSION}`;
|
|
17
17
|
}
|
|
18
18
|
class RemoteJWKSet extends local_js_1.LocalJWKSet {
|
|
@@ -32,15 +32,16 @@ exports.default = (protectedHeader, encodedPayload, options = {}) => {
|
|
|
32
32
|
throw new errors_js_1.JWTInvalid('JWT Claims Set must be a top-level JSON object');
|
|
33
33
|
}
|
|
34
34
|
const { requiredClaims = [], issuer, subject, audience, maxTokenAge } = options;
|
|
35
|
+
const presenceCheck = [...requiredClaims];
|
|
35
36
|
if (maxTokenAge !== undefined)
|
|
36
|
-
|
|
37
|
+
presenceCheck.push('iat');
|
|
37
38
|
if (audience !== undefined)
|
|
38
|
-
|
|
39
|
+
presenceCheck.push('aud');
|
|
39
40
|
if (subject !== undefined)
|
|
40
|
-
|
|
41
|
+
presenceCheck.push('sub');
|
|
41
42
|
if (issuer !== undefined)
|
|
42
|
-
|
|
43
|
-
for (const claim of new Set(
|
|
43
|
+
presenceCheck.push('iss');
|
|
44
|
+
for (const claim of new Set(presenceCheck.reverse())) {
|
|
44
45
|
if (!(claim in payload)) {
|
|
45
46
|
throw new errors_js_1.JWTClaimValidationFailed(`missing required "${claim}" claim`, claim, 'missing');
|
|
46
47
|
}
|
|
@@ -9,7 +9,7 @@ function isCloudflareWorkers() {
|
|
|
9
9
|
let USER_AGENT;
|
|
10
10
|
if (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozilla/5.0 ')) {
|
|
11
11
|
const NAME = 'jose';
|
|
12
|
-
const VERSION = 'v5.1.
|
|
12
|
+
const VERSION = 'v5.1.3';
|
|
13
13
|
USER_AGENT = `${NAME}/${VERSION}`;
|
|
14
14
|
}
|
|
15
15
|
class RemoteJWKSet extends LocalJWKSet {
|
|
@@ -30,15 +30,16 @@ export default (protectedHeader, encodedPayload, options = {}) => {
|
|
|
30
30
|
throw new JWTInvalid('JWT Claims Set must be a top-level JSON object');
|
|
31
31
|
}
|
|
32
32
|
const { requiredClaims = [], issuer, subject, audience, maxTokenAge } = options;
|
|
33
|
+
const presenceCheck = [...requiredClaims];
|
|
33
34
|
if (maxTokenAge !== undefined)
|
|
34
|
-
|
|
35
|
+
presenceCheck.push('iat');
|
|
35
36
|
if (audience !== undefined)
|
|
36
|
-
|
|
37
|
+
presenceCheck.push('aud');
|
|
37
38
|
if (subject !== undefined)
|
|
38
|
-
|
|
39
|
+
presenceCheck.push('sub');
|
|
39
40
|
if (issuer !== undefined)
|
|
40
|
-
|
|
41
|
-
for (const claim of new Set(
|
|
41
|
+
presenceCheck.push('iss');
|
|
42
|
+
for (const claim of new Set(presenceCheck.reverse())) {
|
|
42
43
|
if (!(claim in payload)) {
|
|
43
44
|
throw new JWTClaimValidationFailed(`missing required "${claim}" claim`, claim, 'missing');
|
|
44
45
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jose",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.3",
|
|
4
4
|
"description": "'JSON Web Almost Everything' - JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"browser",
|
|
@@ -68,6 +68,24 @@
|
|
|
68
68
|
"import": "./dist/node/esm/index.js",
|
|
69
69
|
"require": "./dist/node/cjs/index.js"
|
|
70
70
|
},
|
|
71
|
+
"./errors": {
|
|
72
|
+
"types": "./dist/types/util/errors.d.ts",
|
|
73
|
+
"bun": "./dist/browser/util/errors.js",
|
|
74
|
+
"deno": "./dist/browser/util/errors.js",
|
|
75
|
+
"browser": "./dist/browser/util/errors.js",
|
|
76
|
+
"worker": "./dist/browser/util/errors.js",
|
|
77
|
+
"import": "./dist/node/esm/util/errors.js",
|
|
78
|
+
"require": "./dist/node/cjs/util/errors.js"
|
|
79
|
+
},
|
|
80
|
+
"./base64url": {
|
|
81
|
+
"types": "./dist/types/util/base64url.d.ts",
|
|
82
|
+
"bun": "./dist/browser/util/base64url.js",
|
|
83
|
+
"deno": "./dist/browser/util/base64url.js",
|
|
84
|
+
"browser": "./dist/browser/util/base64url.js",
|
|
85
|
+
"worker": "./dist/browser/util/base64url.js",
|
|
86
|
+
"import": "./dist/node/esm/util/base64url.js",
|
|
87
|
+
"require": "./dist/node/cjs/util/base64url.js"
|
|
88
|
+
},
|
|
71
89
|
"./package.json": "./package.json"
|
|
72
90
|
},
|
|
73
91
|
"main": "./dist/node/cjs/index.js",
|