Comparing version 4.7.0 to 4.8.0
@@ -13,3 +13,3 @@ import fetchJwks from '../runtime/fetch_jwks.js'; | ||
this._url = new URL(url.href); | ||
this._options = { agent: options === null || options === void 0 ? void 0 : options.agent }; | ||
this._options = { agent: options === null || options === void 0 ? void 0 : options.agent, headers: options === null || options === void 0 ? void 0 : options.headers }; | ||
this._timeoutDuration = | ||
@@ -16,0 +16,0 @@ typeof (options === null || options === void 0 ? void 0 : options.timeoutDuration) === 'number' ? options === null || options === void 0 ? void 0 : options.timeoutDuration : 5000; |
import { JOSEError, JWKSTimeout } from '../util/errors.js'; | ||
const fetchJwks = async (url, timeout) => { | ||
const fetchJwks = async (url, timeout, options) => { | ||
let controller; | ||
@@ -16,2 +16,3 @@ let id; | ||
redirect: 'manual', | ||
headers: options.headers, | ||
}).catch((err) => { | ||
@@ -18,0 +19,0 @@ if (timedOut) |
export default crypto; | ||
export function isCryptoKey(key) { | ||
try { | ||
return (key != null && | ||
typeof key.extractable === 'boolean' && | ||
typeof key.algorithm.name === 'string' && | ||
typeof key.type === 'string'); | ||
} | ||
catch (_a) { | ||
return false; | ||
} | ||
} | ||
export const isCryptoKey = (key) => key instanceof CryptoKey; |
@@ -16,3 +16,3 @@ "use strict"; | ||
this._url = new URL(url.href); | ||
this._options = { agent: options === null || options === void 0 ? void 0 : options.agent }; | ||
this._options = { agent: options === null || options === void 0 ? void 0 : options.agent, headers: options === null || options === void 0 ? void 0 : options.headers }; | ||
this._timeoutDuration = | ||
@@ -19,0 +19,0 @@ typeof (options === null || options === void 0 ? void 0 : options.timeoutDuration) === 'number' ? options === null || options === void 0 ? void 0 : options.timeoutDuration : 5000; |
@@ -20,6 +20,7 @@ "use strict"; | ||
} | ||
const { agent } = options; | ||
const { agent, headers } = options; | ||
const req = get(url.href, { | ||
agent, | ||
timeout, | ||
headers, | ||
}); | ||
@@ -26,0 +27,0 @@ const [response] = (await Promise.race([(0, events_1.once)(req, 'response'), (0, events_1.once)(req, 'timeout')])); |
@@ -9,4 +9,4 @@ "use strict"; | ||
exports.isCryptoKey = util.types.isCryptoKey | ||
? (obj) => util.types.isCryptoKey(obj) | ||
? (key) => util.types.isCryptoKey(key) | ||
: | ||
(obj) => false; | ||
(key) => false; |
@@ -13,3 +13,3 @@ import fetchJwks from '../runtime/fetch_jwks.js'; | ||
this._url = new URL(url.href); | ||
this._options = { agent: options === null || options === void 0 ? void 0 : options.agent }; | ||
this._options = { agent: options === null || options === void 0 ? void 0 : options.agent, headers: options === null || options === void 0 ? void 0 : options.headers }; | ||
this._timeoutDuration = | ||
@@ -16,0 +16,0 @@ typeof (options === null || options === void 0 ? void 0 : options.timeoutDuration) === 'number' ? options === null || options === void 0 ? void 0 : options.timeoutDuration : 5000; |
@@ -18,6 +18,7 @@ import * as http from 'http'; | ||
} | ||
const { agent } = options; | ||
const { agent, headers } = options; | ||
const req = get(url.href, { | ||
agent, | ||
timeout, | ||
headers, | ||
}); | ||
@@ -24,0 +25,0 @@ const [response] = (await Promise.race([once(req, 'response'), once(req, 'timeout')])); |
@@ -6,4 +6,4 @@ import * as crypto from 'crypto'; | ||
export const isCryptoKey = util.types.isCryptoKey | ||
? (obj) => util.types.isCryptoKey(obj) | ||
? (key) => util.types.isCryptoKey(key) | ||
: | ||
(obj) => false; | ||
(key) => false; |
@@ -35,2 +35,6 @@ import type { JWSHeaderParameters, FlattenedJWSInput, GetKeyFunction } from '../types'; | ||
agent?: any; | ||
/** | ||
* Optional headers to be sent with the HTTP request. | ||
*/ | ||
headers?: Record<string, string>; | ||
} | ||
@@ -37,0 +41,0 @@ interface URL { |
{ | ||
"name": "jose", | ||
"version": "4.7.0", | ||
"version": "4.8.0", | ||
"description": "'JSON Web Almost Everything' - JWA, JWS, JWE, JWT, JWK, JWKS with no dependencies using runtime's native crypto", | ||
@@ -59,2 +59,3 @@ "keywords": [ | ||
"browser": "./dist/browser/index.js", | ||
"worker": "./dist/browser/index.js", | ||
"import": "./dist/node/esm/index.js", | ||
@@ -61,0 +62,0 @@ "require": "./dist/node/cjs/index.js" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
548751
13816