jose-node-cjs-runtime
Advanced tools
Comparing version 5.2.3 to 5.2.4
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createLocalJWKSet = exports.LocalJWKSet = exports.isJWKSLike = void 0; | ||
exports.createLocalJWKSet = exports.LocalJWKSet = void 0; | ||
const import_js_1 = require("../key/import.js"); | ||
@@ -26,3 +26,2 @@ const errors_js_1 = require("../util/errors.js"); | ||
} | ||
exports.isJWKSLike = isJWKSLike; | ||
function isJWKLike(key) { | ||
@@ -29,0 +28,0 @@ return (0, is_object_js_1.default)(key); |
@@ -15,6 +15,6 @@ "use strict"; | ||
const NAME = 'jose'; | ||
const VERSION = 'v5.2.3'; | ||
const VERSION = 'v5.2.4'; | ||
USER_AGENT = `${NAME}/${VERSION}`; | ||
} | ||
class RemoteJWKSet extends local_js_1.LocalJWKSet { | ||
class RemoteJWKSet { | ||
_url; | ||
@@ -27,5 +27,4 @@ _timeoutDuration; | ||
_options; | ||
_local; | ||
constructor(url, options) { | ||
super({ keys: [] }); | ||
this._jwks = undefined; | ||
if (!(url instanceof URL)) { | ||
@@ -53,7 +52,7 @@ throw new TypeError('url must be an instance of URL'); | ||
async getKey(protectedHeader, token) { | ||
if (!this._jwks || !this.fresh()) { | ||
if (!this._local || !this.fresh()) { | ||
await this.reload(); | ||
} | ||
try { | ||
return await super.getKey(protectedHeader, token); | ||
return await this._local(protectedHeader, token); | ||
} | ||
@@ -64,3 +63,3 @@ catch (err) { | ||
await this.reload(); | ||
return super.getKey(protectedHeader, token); | ||
return this._local(protectedHeader, token); | ||
} | ||
@@ -82,6 +81,3 @@ } | ||
.then((json) => { | ||
if (!(0, local_js_1.isJWKSLike)(json)) { | ||
throw new errors_js_1.JWKSInvalid('JSON Web Key Set malformed'); | ||
} | ||
this._jwks = { keys: json.keys }; | ||
this._local = (0, local_js_1.createLocalJWKSet)(json); | ||
this._jwksTimestamp = Date.now(); | ||
@@ -88,0 +84,0 @@ this._pendingFetch = undefined; |
@@ -78,3 +78,3 @@ "use strict"; | ||
throw new errors_js_1.JWEInvalid(`JOSE Header "p2c" (PBES2 Count) missing or invalid`); | ||
const p2cLimit = options?.maxPBES2Count || 10000; | ||
const p2cLimit = options?.maxPBES2Count || 10_000; | ||
if (joseHeader.p2c > p2cLimit) | ||
@@ -81,0 +81,0 @@ throw new errors_js_1.JWEInvalid(`JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds`); |
import type { KeyLike, JWSHeaderParameters, JSONWebKeySet, FlattenedJWSInput } from '../types'; | ||
/** @private */ | ||
export declare function isJWKSLike(jwks: unknown): jwks is JSONWebKeySet; | ||
/** @private */ | ||
export declare class LocalJWKSet<KeyLikeType extends KeyLike = KeyLike> { | ||
@@ -6,0 +4,0 @@ protected _jwks?: JSONWebKeySet; |
{ | ||
"name": "jose-node-cjs-runtime", | ||
"version": "5.2.3", | ||
"version": "5.2.4", | ||
"homepage": "https://github.com/panva/jose", | ||
@@ -5,0 +5,0 @@ "repository": "panva/jose", |
232162
5506