Socket
Socket
Sign inDemoInstall

jose

Package Overview
Dependencies
Maintainers
1
Versions
210
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jose - npm Package Compare versions

Comparing version 5.2.0 to 5.2.1

2

dist/browser/jwe/flattened/decrypt.js

@@ -134,3 +134,3 @@ import { decode as base64url } from '../../runtime/base64url.js';

}
let plaintext = await decrypt(enc, cek, ciphertext, iv, tag, additionalData);
const plaintext = await decrypt(enc, cek, ciphertext, iv, tag, additionalData);
const result = { plaintext };

@@ -137,0 +137,0 @@ if (jwe.protected !== undefined) {

@@ -71,3 +71,3 @@ import { FlattenedEncrypt, unprotected } from '../flattened/encrypt.js';

.encrypt(recipient.key, { ...recipient.options });
let jwe = {
const jwe = {
ciphertext: flattened.ciphertext,

@@ -123,3 +123,3 @@ iv: flattened.iv,

const cek = generateCek(enc);
let jwe = {
const jwe = {
ciphertext: '',

@@ -126,0 +126,0 @@ iv: '',

@@ -82,3 +82,3 @@ import { importJWK } from '../key/import.js';

}
else if (length !== 1) {
if (length !== 1) {
const error = new JWKSMultipleMatchingKeys();

@@ -91,5 +91,3 @@ const { _cached } = this;

}
catch {
continue;
}
catch { }
}

@@ -115,5 +113,3 @@ };

const set = new LocalJWKSet(jwks);
return async function (protectedHeader, token) {
return set.getKey(protectedHeader, token);
};
return async (protectedHeader, token) => set.getKey(protectedHeader, token);
}

@@ -12,3 +12,3 @@ import fetchJwks from '../runtime/fetch_jwks.js';

const NAME = 'jose';
const VERSION = 'v5.2.0';
const VERSION = 'v5.2.1';
USER_AGENT = `${NAME}/${VERSION}`;

@@ -85,5 +85,3 @@ }

const set = new RemoteJWKSet(url, options);
return async function (protectedHeader, token) {
return set.getKey(protectedHeader, token);
};
return async (protectedHeader, token) => set.getKey(protectedHeader, token);
}

@@ -9,6 +9,6 @@ import digest from '../runtime/digest.js';

let i = 0;
buffers.forEach((buffer) => {
for (const buffer of buffers) {
buf.set(buffer, i);
i += buffer.length;
});
}
return buf;

@@ -15,0 +15,0 @@ }

@@ -19,3 +19,3 @@ function message(msg, actual, ...types) {

else if (typeof actual === 'object' && actual != null) {
if (actual.constructor && actual.constructor.name) {
if (actual.constructor?.name) {
msg += ` Received an instance of ${actual.constructor.name}`;

@@ -22,0 +22,0 @@ }

@@ -28,3 +28,3 @@ import { JOSENotSupported } from '../util/errors.js';

}
else if (recognized.get(parameter) && protectedHeader[parameter] === undefined) {
if (recognized.get(parameter) && protectedHeader[parameter] === undefined) {
throw new Err(`Extension Header Parameter "${parameter}" MUST be integrity protected`);

@@ -31,0 +31,0 @@ }

@@ -30,3 +30,3 @@ import crypto, { isCryptoKey } from './webcrypto.js';

}
let i = keyData.indexOf(oid[0], from);
const i = keyData.indexOf(oid[0], from);
if (i === -1)

@@ -126,6 +126,6 @@ return false;

function getElement(seq) {
let result = [];
const result = [];
let next = 0;
while (next < seq.length) {
let nextPart = parseElement(seq.subarray(next));
const nextPart = parseElement(seq.subarray(next));
result.push(nextPart);

@@ -170,3 +170,3 @@ next += nextPart.byteLength;

else {
let numberOfDigits = bytes[position] & 0x7f;
const numberOfDigits = bytes[position] & 0x7f;
position++;

@@ -173,0 +173,0 @@ length = 0;

@@ -100,3 +100,3 @@ import crypto from './webcrypto.js';

break;
case 'EdDSA':
case 'EdDSA': {
keyUsages = ['sign', 'verify'];

@@ -113,2 +113,3 @@ const crv = options?.crv ?? 'Ed25519';

break;
}
case 'ECDH-ES':

@@ -115,0 +116,0 @@ case 'ECDH-ES+A128KW':

@@ -137,3 +137,3 @@ "use strict";

}
let plaintext = await (0, decrypt_js_1.default)(enc, cek, ciphertext, iv, tag, additionalData);
const plaintext = await (0, decrypt_js_1.default)(enc, cek, ciphertext, iv, tag, additionalData);
const result = { plaintext };

@@ -140,0 +140,0 @@ if (jwe.protected !== undefined) {

@@ -82,3 +82,3 @@ "use strict";

.encrypt(recipient.key, { ...recipient.options });
let jwe = {
const jwe = {
ciphertext: flattened.ciphertext,

@@ -134,3 +134,3 @@ iv: flattened.iv,

const cek = (0, cek_js_1.default)(enc);
let jwe = {
const jwe = {
ciphertext: '',

@@ -137,0 +137,0 @@ iv: '',

@@ -87,3 +87,3 @@ "use strict";

}
else if (length !== 1) {
if (length !== 1) {
const error = new errors_js_1.JWKSMultipleMatchingKeys();

@@ -96,5 +96,3 @@ const { _cached } = this;

}
catch {
continue;
}
catch { }
}

@@ -121,6 +119,4 @@ };

const set = new LocalJWKSet(jwks);
return async function (protectedHeader, token) {
return set.getKey(protectedHeader, token);
};
return async (protectedHeader, token) => set.getKey(protectedHeader, token);
}
exports.createLocalJWKSet = createLocalJWKSet;

@@ -15,3 +15,3 @@ "use strict";

const NAME = 'jose';
const VERSION = 'v5.2.0';
const VERSION = 'v5.2.1';
USER_AGENT = `${NAME}/${VERSION}`;

@@ -95,6 +95,4 @@ }

const set = new RemoteJWKSet(url, options);
return async function (protectedHeader, token) {
return set.getKey(protectedHeader, token);
};
return async (protectedHeader, token) => set.getKey(protectedHeader, token);
}
exports.createRemoteJWKSet = createRemoteJWKSet;

@@ -12,6 +12,6 @@ "use strict";

let i = 0;
buffers.forEach((buffer) => {
for (const buffer of buffers) {
buf.set(buffer, i);
i += buffer.length;
});
}
return buf;

@@ -18,0 +18,0 @@ }

@@ -22,3 +22,3 @@ "use strict";

else if (typeof actual === 'object' && actual != null) {
if (actual.constructor && actual.constructor.name) {
if (actual.constructor?.name) {
msg += ` Received an instance of ${actual.constructor.name}`;

@@ -25,0 +25,0 @@ }

@@ -30,3 +30,3 @@ "use strict";

}
else if (recognized.get(parameter) && protectedHeader[parameter] === undefined) {
if (recognized.get(parameter) && protectedHeader[parameter] === undefined) {
throw new Err(`Extension Header Parameter "${parameter}" MUST be integrity protected`);

@@ -33,0 +33,0 @@ }

@@ -82,3 +82,3 @@ "use strict";

case 'ECDH-ES+A192KW':
case 'ECDH-ES+A256KW':
case 'ECDH-ES+A256KW': {
const crv = options?.crv ?? 'P-256';

@@ -98,2 +98,3 @@ switch (crv) {

}
}
default:

@@ -100,0 +101,0 @@ throw new errors_js_1.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');

@@ -47,3 +47,3 @@ "use strict";

case 'ec': {
let namedCurve = key.asymmetricKeyDetails.namedCurve;
const namedCurve = key.asymmetricKeyDetails.namedCurve;
if (raw) {

@@ -50,0 +50,0 @@ return namedCurve;

@@ -134,3 +134,3 @@ import { decode as base64url } from '../../runtime/base64url.js';

}
let plaintext = await decrypt(enc, cek, ciphertext, iv, tag, additionalData);
const plaintext = await decrypt(enc, cek, ciphertext, iv, tag, additionalData);
const result = { plaintext };

@@ -137,0 +137,0 @@ if (jwe.protected !== undefined) {

@@ -79,3 +79,3 @@ import { FlattenedEncrypt, unprotected } from '../flattened/encrypt.js';

.encrypt(recipient.key, { ...recipient.options });
let jwe = {
const jwe = {
ciphertext: flattened.ciphertext,

@@ -131,3 +131,3 @@ iv: flattened.iv,

const cek = generateCek(enc);
let jwe = {
const jwe = {
ciphertext: '',

@@ -134,0 +134,0 @@ iv: '',

@@ -83,3 +83,3 @@ import { importJWK } from '../key/import.js';

}
else if (length !== 1) {
if (length !== 1) {
const error = new JWKSMultipleMatchingKeys();

@@ -92,5 +92,3 @@ const { _cached } = this;

}
catch {
continue;
}
catch { }
}

@@ -116,5 +114,3 @@ };

const set = new LocalJWKSet(jwks);
return async function (protectedHeader, token) {
return set.getKey(protectedHeader, token);
};
return async (protectedHeader, token) => set.getKey(protectedHeader, token);
}

@@ -12,3 +12,3 @@ import fetchJwks from '../runtime/fetch_jwks.js';

const NAME = 'jose';
const VERSION = 'v5.2.0';
const VERSION = 'v5.2.1';
USER_AGENT = `${NAME}/${VERSION}`;

@@ -92,5 +92,3 @@ }

const set = new RemoteJWKSet(url, options);
return async function (protectedHeader, token) {
return set.getKey(protectedHeader, token);
};
return async (protectedHeader, token) => set.getKey(protectedHeader, token);
}

@@ -9,6 +9,6 @@ import digest from '../runtime/digest.js';

let i = 0;
buffers.forEach((buffer) => {
for (const buffer of buffers) {
buf.set(buffer, i);
i += buffer.length;
});
}
return buf;

@@ -15,0 +15,0 @@ }

@@ -19,3 +19,3 @@ function message(msg, actual, ...types) {

else if (typeof actual === 'object' && actual != null) {
if (actual.constructor && actual.constructor.name) {
if (actual.constructor?.name) {
msg += ` Received an instance of ${actual.constructor.name}`;

@@ -22,0 +22,0 @@ }

@@ -28,3 +28,3 @@ import { JOSENotSupported } from '../util/errors.js';

}
else if (recognized.get(parameter) && protectedHeader[parameter] === undefined) {
if (recognized.get(parameter) && protectedHeader[parameter] === undefined) {
throw new Err(`Extension Header Parameter "${parameter}" MUST be integrity protected`);

@@ -31,0 +31,0 @@ }

@@ -78,3 +78,3 @@ import { createSecretKey, generateKeyPair as generateKeyPairCb } from 'node:crypto';

case 'ECDH-ES+A192KW':
case 'ECDH-ES+A256KW':
case 'ECDH-ES+A256KW': {
const crv = options?.crv ?? 'P-256';

@@ -94,2 +94,3 @@ switch (crv) {

}
}
default:

@@ -96,0 +97,0 @@ throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');

@@ -44,3 +44,3 @@ import { KeyObject } from 'node:crypto';

case 'ec': {
let namedCurve = key.asymmetricKeyDetails.namedCurve;
const namedCurve = key.asymmetricKeyDetails.namedCurve;
if (raw) {

@@ -47,0 +47,0 @@ return namedCurve;

@@ -14,3 +14,3 @@ import type { JWK, KeyLike } from '../types';

*
* @param pem PEM-encoded SPKI string
* @param spki PEM-encoded SPKI string
* @param alg (Only effective in Web Crypto API runtimes) JSON Web Algorithm identifier to be used

@@ -25,3 +25,3 @@ * with the imported key, its presence is only enforced in Web Crypto API runtimes. See

*
* @param pem X.509 certificate string
* @param x509 X.509 certificate string
* @param alg (Only effective in Web Crypto API runtimes) JSON Web Algorithm identifier to be used

@@ -36,3 +36,3 @@ * with the imported key, its presence is only enforced in Web Crypto API runtimes. See

*
* @param pem PEM-encoded PKCS#8 string
* @param pkcs8 PEM-encoded PKCS#8 string
* @param alg (Only effective in Web Crypto API runtimes) JSON Web Algorithm identifier to be used

@@ -39,0 +39,0 @@ * with the imported key, its presence is only enforced in Web Crypto API runtimes. See

@@ -7,6 +7,11 @@ import type { KeyLike } from '../types';

export declare class JOSEError extends Error {
/** A unique error code for the particular error subclass. */
/**
* A unique error code for the particular error subclass.
*
* @ignore
*/
static get code(): string;
/** A unique error code for the particular error subclass. */
/** A unique error code for this particular error subclass. */
code: string;
/** @ignore */
constructor(message?: string);

@@ -19,2 +24,3 @@ }

export declare class JWTClaimValidationFailed extends JOSEError {
/** @ignore */
static get code(): 'ERR_JWT_CLAIM_VALIDATION_FAILED';

@@ -26,2 +32,3 @@ code: string;

reason: string;
/** @ignore */
constructor(message: string, claim?: string, reason?: string);

@@ -34,2 +41,3 @@ }

export declare class JWTExpired extends JOSEError implements JWTClaimValidationFailed {
/** @ignore */
static get code(): 'ERR_JWT_EXPIRED';

@@ -41,2 +49,3 @@ code: string;

reason: string;
/** @ignore */
constructor(message: string, claim?: string, reason?: string);

@@ -49,2 +58,3 @@ }

export declare class JOSEAlgNotAllowed extends JOSEError {
/** @ignore */
static get code(): 'ERR_JOSE_ALG_NOT_ALLOWED';

@@ -59,2 +69,3 @@ code: string;

export declare class JOSENotSupported extends JOSEError {
/** @ignore */
static get code(): 'ERR_JOSE_NOT_SUPPORTED';

@@ -68,2 +79,3 @@ code: string;

export declare class JWEDecryptionFailed extends JOSEError {
/** @ignore */
static get code(): 'ERR_JWE_DECRYPTION_FAILED';

@@ -78,2 +90,3 @@ code: string;

export declare class JWEInvalid extends JOSEError {
/** @ignore */
static get code(): 'ERR_JWE_INVALID';

@@ -87,2 +100,3 @@ code: string;

export declare class JWSInvalid extends JOSEError {
/** @ignore */
static get code(): 'ERR_JWS_INVALID';

@@ -96,2 +110,3 @@ code: string;

export declare class JWTInvalid extends JOSEError {
/** @ignore */
static get code(): 'ERR_JWT_INVALID';

@@ -105,2 +120,3 @@ code: string;

export declare class JWKInvalid extends JOSEError {
/** @ignore */
static get code(): 'ERR_JWK_INVALID';

@@ -114,2 +130,3 @@ code: string;

export declare class JWKSInvalid extends JOSEError {
/** @ignore */
static get code(): 'ERR_JWKS_INVALID';

@@ -123,2 +140,3 @@ code: string;

export declare class JWKSNoMatchingKey extends JOSEError {
/** @ignore */
static get code(): 'ERR_JWKS_NO_MATCHING_KEY';

@@ -144,2 +162,3 @@ code: string;

export declare class JWKSTimeout extends JOSEError {
/** @ignore */
static get code(): 'ERR_JWKS_TIMEOUT';

@@ -154,2 +173,3 @@ code: string;

export declare class JWSSignatureVerificationFailed extends JOSEError {
/** @ignore */
static get code(): 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED';

@@ -156,0 +176,0 @@ code: string;

{
"name": "jose",
"version": "5.2.0",
"description": "'JSON Web Almost Everything' - JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes",
"version": "5.2.1",
"description": "JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes",
"keywords": [

@@ -6,0 +6,0 @@ "browser",

@@ -31,6 +31,6 @@ # jose

- [JWT Claims Set Validation & Signature Verification](docs/functions/jwt_verify.jwtVerify.md) using the `jwtVerify` function
- [Using a remote JSON Web Key Set (JWKS)](docs/functions/jwks_remote.createRemoteJWKSet.md)
- [Using a local JSON Web Key Set (JWKS)](docs/functions/jwks_local.createLocalJWKSet.md)
- [Signing](docs/classes/jwt_sign.SignJWT.md) using the `SignJWT` class
- [Verification & JWT Claims Set Validation](docs/functions/jwt_verify.jwtVerify.md) using the `jwtVerify` function
- [Using a remote JWKS](docs/functions/jwks_remote.createRemoteJWKSet.md)
- [Using a local JWKS](docs/functions/jwks_local.createLocalJWKSet.md)
- Utility functions

@@ -44,4 +44,4 @@ - [Decoding Token's Protected Header](docs/functions/util_decode_protected_header.decodeProtectedHeader.md)

- [Decryption & JWT Claims Set Validation](docs/functions/jwt_decrypt.jwtDecrypt.md) using the `jwtDecrypt` function
- [Encryption](docs/classes/jwt_encrypt.EncryptJWT.md) using the `EncryptJWT` class
- [Decryption & JWT Claims Set Validation](docs/functions/jwt_decrypt.jwtDecrypt.md) using the `jwtDecrypt` function
- Utility functions

@@ -73,4 +73,4 @@ - [Decoding Token's Protected Header](docs/functions/util_decode_protected_header.decodeProtectedHeader.md)

- Verification - [Compact](docs/functions/jws_compact_verify.compactVerify.md), [Flattened JSON](docs/functions/jws_flattened_verify.flattenedVerify.md), [General JSON](docs/functions/jws_general_verify.generalVerify.md)
- [Verify using a remote JWKS](docs/functions/jwks_remote.createRemoteJWKSet.md)
- [Verify using a local JWKS](docs/functions/jwks_local.createLocalJWKSet.md)
- [Using a remote JSON Web Key Set (JWKS)](docs/functions/jwks_remote.createRemoteJWKSet.md)
- [Using a local JSON Web Key Set (JWKS)](docs/functions/jwks_local.createLocalJWKSet.md)
- Utility functions

@@ -77,0 +77,0 @@ - [Decoding Token's Protected Header](docs/functions/util_decode_protected_header.decodeProtectedHeader.md)

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc