Socket
Socket
Sign inDemoInstall

jose

Package Overview
Dependencies
0
Maintainers
1
Versions
193
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.2.3 to 5.2.4

2

dist/browser/jwks/local.js

@@ -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,9 +12,7 @@ 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 {
constructor(url, options) {
super({ keys: [] });
this._jwks = undefined;
if (!(url instanceof URL)) {

@@ -42,7 +40,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);
}

@@ -53,3 +51,3 @@ catch (err) {

await this.reload();
return super.getKey(protectedHeader, token);
return this._local(protectedHeader, token);
}

@@ -71,6 +69,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();

@@ -77,0 +72,0 @@ this._pendingFetch = undefined;

"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`);

@@ -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",
"version": "5.2.3",
"version": "5.2.4",
"description": "JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes",

@@ -68,2 +68,3 @@ "keywords": [

"worker": "./dist/browser/index.js",
"workerd": "./dist/browser/index.js",
"import": "./dist/node/esm/index.js",

@@ -78,2 +79,3 @@ "require": "./dist/node/cjs/index.js"

"worker": "./dist/browser/util/errors.js",
"workerd": "./dist/browser/util/errors.js",
"import": "./dist/node/esm/util/errors.js",

@@ -88,2 +90,3 @@ "require": "./dist/node/cjs/util/errors.js"

"worker": "./dist/browser/util/base64url.js",
"workerd": "./dist/browser/util/base64url.js",
"import": "./dist/node/esm/util/base64url.js",

@@ -90,0 +93,0 @@ "require": "./dist/node/cjs/util/base64url.js"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc