jose-node-esm-runtime
Advanced tools
Comparing version 5.2.3 to 5.2.4
@@ -17,3 +17,3 @@ import { importJWK } from '../key/import.js'; | ||
} | ||
export function isJWKSLike(jwks) { | ||
function isJWKSLike(jwks) { | ||
return (jwks && | ||
@@ -20,0 +20,0 @@ typeof jwks === 'object' && |
import fetchJwks from '../runtime/fetch_jwks.js'; | ||
import { JWKSInvalid, JWKSNoMatchingKey } from '../util/errors.js'; | ||
import { isJWKSLike, LocalJWKSet } from './local.js'; | ||
import { JWKSNoMatchingKey } from '../util/errors.js'; | ||
import { createLocalJWKSet } from './local.js'; | ||
function isCloudflareWorkers() { | ||
@@ -12,6 +12,6 @@ return (typeof WebSocketPair !== 'undefined' || | ||
const NAME = 'jose'; | ||
const VERSION = 'v5.2.3'; | ||
const VERSION = 'v5.2.4'; | ||
USER_AGENT = `${NAME}/${VERSION}`; | ||
} | ||
class RemoteJWKSet extends LocalJWKSet { | ||
class RemoteJWKSet { | ||
_url; | ||
@@ -24,5 +24,4 @@ _timeoutDuration; | ||
_options; | ||
_local; | ||
constructor(url, options) { | ||
super({ keys: [] }); | ||
this._jwks = undefined; | ||
if (!(url instanceof URL)) { | ||
@@ -50,7 +49,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); | ||
} | ||
@@ -61,3 +60,3 @@ catch (err) { | ||
await this.reload(); | ||
return super.getKey(protectedHeader, token); | ||
return this._local(protectedHeader, token); | ||
} | ||
@@ -79,6 +78,3 @@ } | ||
.then((json) => { | ||
if (!isJWKSLike(json)) { | ||
throw new JWKSInvalid('JSON Web Key Set malformed'); | ||
} | ||
this._jwks = { keys: json.keys }; | ||
this._local = createLocalJWKSet(json); | ||
this._jwksTimestamp = Date.now(); | ||
@@ -85,0 +81,0 @@ this._pendingFetch = undefined; |
@@ -76,3 +76,3 @@ import { unwrap as aesKw } from '../runtime/aeskw.js'; | ||
throw new JWEInvalid(`JOSE Header "p2c" (PBES2 Count) missing or invalid`); | ||
const p2cLimit = options?.maxPBES2Count || 10000; | ||
const p2cLimit = options?.maxPBES2Count || 10_000; | ||
if (joseHeader.p2c > p2cLimit) | ||
@@ -79,0 +79,0 @@ throw new 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-esm-runtime", | ||
"version": "5.2.3", | ||
"version": "5.2.4", | ||
"homepage": "https://github.com/panva/jose", | ||
@@ -5,0 +5,0 @@ "repository": "panva/jose", |
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
206609
5169