jose 4.7.0 → 4.8.0
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/runtime/fetch_jwks.js +2 -1
- package/dist/browser/runtime/webcrypto.js +1 -11
- package/dist/node/cjs/jwks/remote.js +1 -1
- package/dist/node/cjs/runtime/fetch_jwks.js +2 -1
- package/dist/node/cjs/runtime/webcrypto.js +2 -2
- package/dist/node/esm/jwks/remote.js +1 -1
- package/dist/node/esm/runtime/fetch_jwks.js +2 -1
- package/dist/node/esm/runtime/webcrypto.js +2 -2
- package/dist/types/jwks/remote.d.ts +4 -0
- package/package.json +2 -1
|
@@ -10,7 +10,7 @@ class RemoteJWKSet extends LocalJWKSet {
|
|
|
10
10
|
throw new TypeError('url must be an instance of URL');
|
|
11
11
|
}
|
|
12
12
|
this._url = new URL(url.href);
|
|
13
|
-
this._options = { agent: options === null || options === void 0 ? void 0 : options.agent };
|
|
13
|
+
this._options = { agent: options === null || options === void 0 ? void 0 : options.agent, headers: options === null || options === void 0 ? void 0 : options.headers };
|
|
14
14
|
this._timeoutDuration =
|
|
15
15
|
typeof (options === null || options === void 0 ? void 0 : options.timeoutDuration) === 'number' ? options === null || options === void 0 ? void 0 : options.timeoutDuration : 5000;
|
|
16
16
|
this._cooldownDuration =
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JOSEError, JWKSTimeout } from '../util/errors.js';
|
|
2
|
-
const fetchJwks = async (url, timeout) => {
|
|
2
|
+
const fetchJwks = async (url, timeout, options) => {
|
|
3
3
|
let controller;
|
|
4
4
|
let id;
|
|
5
5
|
let timedOut = false;
|
|
@@ -13,6 +13,7 @@ const fetchJwks = async (url, timeout) => {
|
|
|
13
13
|
const response = await fetch(url.href, {
|
|
14
14
|
signal: controller ? controller.signal : undefined,
|
|
15
15
|
redirect: 'manual',
|
|
16
|
+
headers: options.headers,
|
|
16
17
|
}).catch((err) => {
|
|
17
18
|
if (timedOut)
|
|
18
19
|
throw new JWKSTimeout();
|
|
@@ -1,12 +1,2 @@
|
|
|
1
1
|
export default crypto;
|
|
2
|
-
export
|
|
3
|
-
try {
|
|
4
|
-
return (key != null &&
|
|
5
|
-
typeof key.extractable === 'boolean' &&
|
|
6
|
-
typeof key.algorithm.name === 'string' &&
|
|
7
|
-
typeof key.type === 'string');
|
|
8
|
-
}
|
|
9
|
-
catch (_a) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
2
|
+
export const isCryptoKey = (key) => key instanceof CryptoKey;
|
|
@@ -13,7 +13,7 @@ class RemoteJWKSet extends local_js_1.LocalJWKSet {
|
|
|
13
13
|
throw new TypeError('url must be an instance of URL');
|
|
14
14
|
}
|
|
15
15
|
this._url = new URL(url.href);
|
|
16
|
-
this._options = { agent: options === null || options === void 0 ? void 0 : options.agent };
|
|
16
|
+
this._options = { agent: options === null || options === void 0 ? void 0 : options.agent, headers: options === null || options === void 0 ? void 0 : options.headers };
|
|
17
17
|
this._timeoutDuration =
|
|
18
18
|
typeof (options === null || options === void 0 ? void 0 : options.timeoutDuration) === 'number' ? options === null || options === void 0 ? void 0 : options.timeoutDuration : 5000;
|
|
19
19
|
this._cooldownDuration =
|
|
@@ -17,10 +17,11 @@ const fetchJwks = async (url, timeout, options) => {
|
|
|
17
17
|
default:
|
|
18
18
|
throw new TypeError('Unsupported URL protocol.');
|
|
19
19
|
}
|
|
20
|
-
const { agent } = options;
|
|
20
|
+
const { agent, headers } = options;
|
|
21
21
|
const req = get(url.href, {
|
|
22
22
|
agent,
|
|
23
23
|
timeout,
|
|
24
|
+
headers,
|
|
24
25
|
});
|
|
25
26
|
const [response] = (await Promise.race([(0, events_1.once)(req, 'response'), (0, events_1.once)(req, 'timeout')]));
|
|
26
27
|
if (!response) {
|
|
@@ -6,6 +6,6 @@ const util = require("util");
|
|
|
6
6
|
const webcrypto = crypto.webcrypto;
|
|
7
7
|
exports.default = webcrypto;
|
|
8
8
|
exports.isCryptoKey = util.types.isCryptoKey
|
|
9
|
-
? (
|
|
9
|
+
? (key) => util.types.isCryptoKey(key)
|
|
10
10
|
:
|
|
11
|
-
(
|
|
11
|
+
(key) => false;
|
|
@@ -10,7 +10,7 @@ class RemoteJWKSet extends LocalJWKSet {
|
|
|
10
10
|
throw new TypeError('url must be an instance of URL');
|
|
11
11
|
}
|
|
12
12
|
this._url = new URL(url.href);
|
|
13
|
-
this._options = { agent: options === null || options === void 0 ? void 0 : options.agent };
|
|
13
|
+
this._options = { agent: options === null || options === void 0 ? void 0 : options.agent, headers: options === null || options === void 0 ? void 0 : options.headers };
|
|
14
14
|
this._timeoutDuration =
|
|
15
15
|
typeof (options === null || options === void 0 ? void 0 : options.timeoutDuration) === 'number' ? options === null || options === void 0 ? void 0 : options.timeoutDuration : 5000;
|
|
16
16
|
this._cooldownDuration =
|
|
@@ -15,10 +15,11 @@ const fetchJwks = async (url, timeout, options) => {
|
|
|
15
15
|
default:
|
|
16
16
|
throw new TypeError('Unsupported URL protocol.');
|
|
17
17
|
}
|
|
18
|
-
const { agent } = options;
|
|
18
|
+
const { agent, headers } = options;
|
|
19
19
|
const req = get(url.href, {
|
|
20
20
|
agent,
|
|
21
21
|
timeout,
|
|
22
|
+
headers,
|
|
22
23
|
});
|
|
23
24
|
const [response] = (await Promise.race([once(req, 'response'), once(req, 'timeout')]));
|
|
24
25
|
if (!response) {
|
|
@@ -3,6 +3,6 @@ import * as util from 'util';
|
|
|
3
3
|
const webcrypto = crypto.webcrypto;
|
|
4
4
|
export default webcrypto;
|
|
5
5
|
export const isCryptoKey = util.types.isCryptoKey
|
|
6
|
-
? (
|
|
6
|
+
? (key) => util.types.isCryptoKey(key)
|
|
7
7
|
:
|
|
8
|
-
(
|
|
8
|
+
(key) => false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jose",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.0",
|
|
4
4
|
"description": "'JSON Web Almost Everything' - JWA, JWS, JWE, JWT, JWK, JWKS with no dependencies using runtime's native crypto",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"browser",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"exports": {
|
|
57
57
|
".": {
|
|
58
58
|
"browser": "./dist/browser/index.js",
|
|
59
|
+
"worker": "./dist/browser/index.js",
|
|
59
60
|
"import": "./dist/node/esm/index.js",
|
|
60
61
|
"require": "./dist/node/cjs/index.js"
|
|
61
62
|
},
|