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.9.2 to 5.9.3

2

dist/browser/jwks/remote.js

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

const NAME = 'jose';
const VERSION = 'v5.9.2';
const VERSION = 'v5.9.3';
USER_AGENT = `${NAME}/${VERSION}`;

@@ -16,0 +16,0 @@ }

@@ -47,3 +47,4 @@ import { JWTClaimValidationFailed, JWTExpired, JWTInvalid } from '../util/errors.js';

}
if (issuer && !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) {
if (issuer &&
!(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) {
throw new JWTClaimValidationFailed('unexpected "iss" claim value', payload, 'iss', 'check_failed');

@@ -50,0 +51,0 @@ }

@@ -25,3 +25,4 @@ import { encoder, concat, uint32be, lengthAndInput, concatKdf } from '../lib/buffer_utils.js';

length =
Math.ceil(parseInt(publicKey.algorithm.namedCurve.substr(-3), 10) / 8) << 3;
Math.ceil(parseInt(publicKey.algorithm.namedCurve.substr(-3), 10) / 8) <<
3;
}

@@ -28,0 +29,0 @@ const sharedSecret = new Uint8Array(await crypto.subtle.deriveBits({

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

}
return (crypto.subtle.generateKey(algorithm, options?.extractable ?? false, keyUsages));
return crypto.subtle.generateKey(algorithm, options?.extractable ?? false, keyUsages);
}

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

const NAME = 'jose';
const VERSION = 'v5.9.2';
const VERSION = 'v5.9.3';
USER_AGENT = `${NAME}/${VERSION}`;

@@ -19,0 +19,0 @@ }

@@ -49,3 +49,4 @@ "use strict";

}
if (issuer && !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) {
if (issuer &&
!(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) {
throw new errors_js_1.JWTClaimValidationFailed('unexpected "iss" claim value', payload, 'iss', 'check_failed');

@@ -52,0 +53,0 @@ }

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

const NAME = 'jose';
const VERSION = 'v5.9.2';
const VERSION = 'v5.9.3';
USER_AGENT = `${NAME}/${VERSION}`;

@@ -16,0 +16,0 @@ }

@@ -47,3 +47,4 @@ import { JWTClaimValidationFailed, JWTExpired, JWTInvalid } from '../util/errors.js';

}
if (issuer && !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) {
if (issuer &&
!(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) {
throw new JWTClaimValidationFailed('unexpected "iss" claim value', payload, 'iss', 'check_failed');

@@ -50,0 +51,0 @@ }

@@ -6,3 +6,3 @@ import type { JWK, CompactVerifyResult, FlattenedJWSInput, GenericGetKeyFunction, CompactJWSHeaderParameters, KeyLike, VerifyOptions, ResolvedKey } from '../../types';

*
* @see [createRemoteJWKSet](../functions/jwks_remote.createRemoteJWKSet.md#function-createremotejwkset) to verify using a remote JSON Web Key Set.
* @see {@link jwks/remote.createRemoteJWKSet createRemoteJWKSet} to verify using a remote JSON Web Key Set.
*/

@@ -9,0 +9,0 @@ export interface CompactVerifyGetKey extends GenericGetKeyFunction<CompactJWSHeaderParameters, FlattenedJWSInput, KeyLike | JWK | Uint8Array> {

@@ -6,3 +6,3 @@ import type { JWK, FlattenedVerifyResult, KeyLike, FlattenedJWSInput, JWSHeaderParameters, VerifyOptions, GenericGetKeyFunction, ResolvedKey } from '../../types';

*
* @see [createRemoteJWKSet](../functions/jwks_remote.createRemoteJWKSet.md#function-createremotejwkset) to verify using a remote JSON Web Key Set.
* @see {@link jwks/remote.createRemoteJWKSet createRemoteJWKSet} to verify using a remote JSON Web Key Set.
*/

@@ -9,0 +9,0 @@ export interface FlattenedVerifyGetKey extends GenericGetKeyFunction<JWSHeaderParameters | undefined, FlattenedJWSInput, KeyLike | JWK | Uint8Array> {

@@ -6,3 +6,3 @@ import type { JWK, GeneralJWSInput, GeneralVerifyResult, FlattenedJWSInput, GenericGetKeyFunction, JWSHeaderParameters, KeyLike, VerifyOptions, ResolvedKey } from '../../types';

*
* @see [createRemoteJWKSet](../functions/jwks_remote.createRemoteJWKSet.md#function-createremotejwkset) to verify using a remote JSON Web Key Set.
* @see {@link jwks/remote.createRemoteJWKSet createRemoteJWKSet} to verify using a remote JSON Web Key Set.
*/

@@ -9,0 +9,0 @@ export interface GeneralVerifyGetKey extends GenericGetKeyFunction<JWSHeaderParameters, FlattenedJWSInput, KeyLike | JWK | Uint8Array> {

@@ -9,3 +9,3 @@ import type { JWK, JWTPayload, KeyLike, VerifyOptions, JWTClaimVerificationOptions, JWTHeaderParameters, GenericGetKeyFunction, FlattenedJWSInput, JWTVerifyResult, ResolvedKey } from '../types';

*
* @see [createRemoteJWKSet](../functions/jwks_remote.createRemoteJWKSet.md#function-createremotejwkset) to verify using a remote JSON Web Key Set.
* @see {@link jwks/remote.createRemoteJWKSet createRemoteJWKSet} to verify using a remote JSON Web Key Set.
*/

@@ -12,0 +12,0 @@ export interface JWTVerifyGetKey extends GenericGetKeyFunction<JWTHeaderParameters, FlattenedJWSInput, KeyLike | JWK | Uint8Array> {

import type { JWK, KeyLike } from '../types';
/**
* Exports a runtime-specific public key representation (KeyObject or CryptoKey) to a PEM-encoded
* SPKI string format.
* Exports a runtime-specific public key representation ({@link !KeyObject} or {@link !CryptoKey}) to
* a PEM-encoded SPKI string format.
*

@@ -13,4 +13,4 @@ * This function is exported (as a named export) from the main `'jose'` module entry point as well

/**
* Exports a runtime-specific private key representation (KeyObject or CryptoKey) to a PEM-encoded
* PKCS8 string format.
* Exports a runtime-specific private key representation ({@link !KeyObject} or {@link !CryptoKey}) to
* a PEM-encoded PKCS8 string format.
*

@@ -17,0 +17,0 @@ * This function is exported (as a named export) from the main `'jose'` module entry point as well

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

* (Only effective in Web Crypto API runtimes) The value to use as
* {@link https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/generateKey SubtleCrypto.generateKey()}
* `extractable` argument. Default is false.
* {@link !SubtleCrypto.generateKey} `extractable` argument. Default is false.
*

@@ -25,0 +24,0 @@ */

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

* (Only effective in Web Crypto API runtimes) The value to use as
* {@link https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/generateKey SubtleCrypto.generateKey()}
* `extractable` argument. Default is false.
* {@link !SubtleCrypto.generateKey} `extractable` argument. Default is false.
*/

@@ -9,0 +8,0 @@ extractable?: boolean;

import type { JWK, KeyLike } from '../types';
export interface PEMImportOptions {
/**
* (Only effective in Web Crypto API runtimes) The value to use as
* {@link https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey SubtleCrypto.importKey()}
* (Only effective in Web Crypto API runtimes) The value to use as {@link !SubtleCrypto.importKey}
* `extractable` argument. Default is false.

@@ -11,4 +10,4 @@ */

/**
* Imports a PEM-encoded SPKI string as a runtime-specific public key representation (KeyObject or
* CryptoKey).
* Imports a PEM-encoded SPKI string as a runtime-specific public key representation
* ({@link !KeyObject} or {@link !CryptoKey}).
*

@@ -30,3 +29,3 @@ * Note: The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in

* Imports the SPKI from an X.509 string certificate as a runtime-specific public key representation
* (KeyObject or CryptoKey).
* ({@link !KeyObject} or {@link !CryptoKey}).
*

@@ -47,4 +46,4 @@ * Note: The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in

/**
* Imports a PEM-encoded PKCS#8 string as a runtime-specific private key representation (KeyObject
* or CryptoKey).
* Imports a PEM-encoded PKCS#8 string as a runtime-specific private key representation
* ({@link !KeyObject} or {@link !CryptoKey}).
*

@@ -69,3 +68,3 @@ * Note: The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in

* Note: When the runtime is using {@link https://w3c.github.io/webcrypto/ Web Cryptography API} the
* jwk parameters "use", "key_ops", and "ext" are also used in the resulting `CryptoKey`.
* jwk parameters "use", "key_ops", and "ext" are also used in the resulting {@link !CryptoKey}.
*

@@ -72,0 +71,0 @@ * This function is exported (as a named export) from the main `'jose'` module entry point as well

/**
* KeyLike are runtime-specific classes representing asymmetric keys or symmetric secrets. These are
* instances of {@link https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey CryptoKey} and
* additionally {@link https://nodejs.org/api/crypto.html#class-keyobject KeyObject} in Node.js
* runtime.
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array Uint8Array}
* instances are also accepted as symmetric secret representation only.
* instances of {@link !CryptoKey} and additionally {@link !KeyObject} in Node.js runtime.
* {@link !Uint8Array} instances are also accepted as symmetric secret representation only.
*
* [Key Import Functions](../modules/key_import.md) can be used to import PEM, or JWK formatted
* asymmetric keys and certificates to these runtime-specific representations.
* {@link key/import Key Import Functions} can be used to import PEM, or JWK formatted asymmetric
* keys and certificates to these runtime-specific representations.
*
* In Node.js the {@link https://nodejs.org/api/buffer.html#buffer Buffer} class is a subclass of
* Uint8Array and so Buffer can be provided for symmetric secrets as well.
* In Node.js the {@link !Buffer} class is a subclass of {@link !Uint8Array} and so {@link !Buffer} can
* be provided for symmetric secrets as well.
*
* {@link https://nodejs.org/api/crypto.html#class-keyobject KeyObject} is a representation of a
* key/secret available in the Node.js runtime. In addition to the import functions of this library
* you may use the runtime APIs
* {@link https://nodejs.org/api/crypto.html#cryptocreatepublickeykey crypto.createPublicKey},
* {@link https://nodejs.org/api/crypto.html#cryptocreateprivatekeykey crypto.createPrivateKey}, and
* {@link https://nodejs.org/api/crypto.html#cryptocreatesecretkeykey-encoding crypto.createSecretKey}
* to obtain a `KeyObject` from your existing key material.
* {@link !KeyObject} is a representation of a key/secret available in the Node.js runtime. In
* addition to the {@link key/import Key Import Functions} you may use the runtime APIs
* {@link !createPublicKey}, {@link !createPrivateKey}, and {@link !createSecretKey} to obtain a
* {@link !KeyObject} from your existing key material.
*
* {@link https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey CryptoKey} is a representation
* of a key/secret available in the Browser and Web-interoperable runtimes. In addition to the
* import functions of this library you may use the
* {@link https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey SubtleCrypto.importKey}
* API to obtain a CryptoKey from your existing key material.
* {@link !CryptoKey} is a representation of a key/secret available in the Browser and
* Web-interoperable runtimes. In addition to the {@link key/import Key Import Functions} you may use
* the {@link !SubtleCrypto.importKey} API to obtain a {@link !CryptoKey} from your existing key
* material.
*

@@ -34,21 +27,25 @@ */

export interface JWKParameters {
/** JWK "kty" (Key Type) Parameter. */
/** JWK "kty" (Key Type) Parameter */
kty: string
/** JWK "alg" (Algorithm) Parameter. */
/**
* JWK "alg" (Algorithm) Parameter
*
* @see {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}
*/
alg?: string
/** JWK "key_ops" (Key Operations) Parameter. */
/** JWK "key_ops" (Key Operations) Parameter */
key_ops?: string[]
/** JWK "ext" (Extractable) Parameter. */
/** JWK "ext" (Extractable) Parameter */
ext?: boolean
/** JWK "use" (Public Key Use) Parameter. */
/** JWK "use" (Public Key Use) Parameter */
use?: string
/** JWK "x5c" (X.509 Certificate Chain) Parameter. */
/** JWK "x5c" (X.509 Certificate Chain) Parameter */
x5c?: string[]
/** JWK "x5t" (X.509 Certificate SHA-1 Thumbprint) Parameter. */
/** JWK "x5t" (X.509 Certificate SHA-1 Thumbprint) Parameter */
x5t?: string
/** "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Parameter. */
/** JWK "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Parameter */
'x5t#S256'?: string
/** JWK "x5u" (X.509 URL) Parameter. */
/** JWK "x5u" (X.509 URL) Parameter */
x5u?: string
/** JWK "kid" (Key ID) Parameter. */
/** JWK "kid" (Key ID) Parameter */
kid?: string

@@ -59,5 +56,5 @@ }

export interface JWK_OKP_Public extends JWKParameters {
/** The Subtype of Key Pair */
/** OKP JWK "crv" (The Subtype of Key Pair) Parameter */
crv: string
/** The public key */
/** OKP JWK "x" (The public key) Parameter */
x: string

@@ -68,3 +65,3 @@ }

export interface JWK_OKP_Private extends JWK_OKP_Public, JWKParameters {
/** The Private Key */
/** OKP JWK "d" (The Private Key) Parameter */
d: string

@@ -75,7 +72,7 @@ }

export interface JWK_EC_Public extends JWKParameters {
/** Curve */
/** EC JWK "crv" (Curve) Parameter */
crv: string
/** X Coordinate */
/** EC JWK "x" (X Coordinate) Parameter */
x: string
/** Y Coordinate */
/** EC JWK "y" (Y Coordinate) Parameter */
y: string

@@ -86,3 +83,3 @@ }

export interface JWK_EC_Private extends JWK_EC_Public, JWKParameters {
/** ECC Private Key */
/** EC JWK "d" (ECC Private Key) Parameter */
d: string

@@ -93,5 +90,5 @@ }

export interface JWK_RSA_Public extends JWKParameters {
/** Exponent */
/** RSA JWK "e" (Exponent) Parameter */
e: string
/** Modulus */
/** RSA JWK "n" (Modulus) Parameter */
n: string

@@ -102,9 +99,13 @@ }

export interface JWK_RSA_Private extends JWK_RSA_Public, JWKParameters {
/** Private Exponent */
/** RSA JWK "d" (Private Exponent) Parameter */
d: string
/** First Factor CRT Exponent */
/** RSA JWK "dp" (First Factor CRT Exponent) Parameter */
dp: string
/** Second Factor CRT Exponent */
/** RSA JWK "dq" (Second Factor CRT Exponent) Parameter */
dq: string
/** Other Primes Info. This parameter is not supported. */
/**
* RSA JWK "oth" (Other Primes Info) Parameter
*
* This parameter is not supported
*/
oth?: Array<{

@@ -115,7 +116,7 @@ d?: string

}>
/** First Prime Factor */
/** RSA JWK "p" (First Prime Factor) Parameter */
p: string
/** Second Prime Factor */
/** RSA JWK "q" (Second Prime Factor) Parameter */
q: string
/** First CRT Coefficient */
/** RSA JWK "qi" (First CRT Coefficient) Parameter */
qi: string

@@ -126,3 +127,3 @@ }

export interface JWK_oct extends JWKParameters {
/** Key Value */
/** Oct JWK "k" (Key Value) Parameter */
k: string

@@ -145,23 +146,27 @@ }

/**
* - (EC) Curve
* - (OKP) The Subtype of Key Pair
* - EC JWK "crv" (Curve) Parameter
* - OKP JWK "crv" (The Subtype of Key Pair) Parameter
*/
crv?: string
/**
* - (Private RSA) Private Exponent
* - (Private EC) ECC Private Key
* - (Private OKP) The Private Key
* - Private RSA JWK "d" (Private Exponent) Parameter
* - Private EC JWK "d" (ECC Private Key) Parameter
* - Private OKP JWK "d" (The Private Key) Parameter
*/
d?: string
/** (Private RSA) First Factor CRT Exponent */
/** Private RSA JWK "dp" (First Factor CRT Exponent) Parameter */
dp?: string
/** (Private RSA) Second Factor CRT Exponent */
/** Private RSA JWK "dq" (Second Factor CRT Exponent) Parameter */
dq?: string
/** (RSA) Exponent */
/** RSA JWK "e" (Exponent) Parameter */
e?: string
/** (oct) Key Value */
/** Oct JWK "k" (Key Value) Parameter */
k?: string
/** (RSA) Modulus */
/** RSA JWK "n" (Modulus) Parameter */
n?: string
/** (Private RSA) Other Primes Info. This parameter is not supported. */
/**
* Private RSA JWK "oth" (Other Primes Info) Parameter
*
* This parameter is not supported
*/
oth?: Array<{

@@ -172,14 +177,14 @@ d?: string

}>
/** (Private RSA) First Prime Factor */
/** Private RSA JWK "p" (First Prime Factor) Parameter */
p?: string
/** (Private RSA) Second Prime Factor */
/** Private RSA JWK "q" (Second Prime Factor) Parameter */
q?: string
/** (Private RSA) First CRT Coefficient */
/** Private RSA JWK "qi" (First CRT Coefficient) Parameter */
qi?: string
/**
* - (EC) X Coordinate
* - (OKP) The public key
* - EC JWK "x" (X Coordinate) Parameter
* - OKP JWK "x" (The public key) Parameter
*/
x?: string
/** (EC) Y Coordinate */
/** EC JWK "y" (Y Coordinate) Parameter */
y?: string

@@ -216,4 +221,4 @@ }

/**
* Flattened JWS definition for verify function inputs, allows payload as Uint8Array for detached
* signature validation.
* Flattened JWS definition for verify function inputs, allows payload as {@link !Uint8Array} for
* detached signature validation.
*/

@@ -231,3 +236,3 @@ export interface FlattenedJWSInput {

* The "payload" member MUST be present and contain the value BASE64URL(JWS Payload). When RFC7797
* "b64": false is used the value passed may also be a Uint8Array.
* "b64": false is used the value passed may also be a {@link !Uint8Array}.
*/

@@ -248,4 +253,4 @@ payload: string | Uint8Array

/**
* General JWS definition for verify function inputs, allows payload as Uint8Array for detached
* signature validation.
* General JWS definition for verify function inputs, allows payload as {@link !Uint8Array} for
* detached signature validation.
*/

@@ -256,3 +261,3 @@ export interface GeneralJWSInput {

* JWS Unencoded Payload ({@link https://www.rfc-editor.org/rfc/rfc7797 RFC7797}) "b64": false is
* used the value passed may also be a Uint8Array.
* used the value passed may also be a {@link !Uint8Array}.
*/

@@ -287,24 +292,24 @@ payload: string | Uint8Array

export interface JoseHeaderParameters {
/** "kid" (Key ID) Header Parameter. */
/** "kid" (Key ID) Header Parameter */
kid?: string
/** "x5t" (X.509 Certificate SHA-1 Thumbprint) Header Parameter. */
/** "x5t" (X.509 Certificate SHA-1 Thumbprint) Header Parameter */
x5t?: string
/** "x5c" (X.509 Certificate Chain) Header Parameter. */
/** "x5c" (X.509 Certificate Chain) Header Parameter */
x5c?: string[]
/** "x5u" (X.509 URL) Header Parameter. */
/** "x5u" (X.509 URL) Header Parameter */
x5u?: string
/** "jku" (JWK Set URL) Header Parameter. */
/** "jku" (JWK Set URL) Header Parameter */
jku?: string
/** "jwk" (JSON Web Key) Header Parameter. */
/** "jwk" (JSON Web Key) Header Parameter */
jwk?: Pick<JWK, 'kty' | 'crv' | 'x' | 'y' | 'e' | 'n'>
/** "typ" (Type) Header Parameter. */
/** "typ" (Type) Header Parameter */
typ?: string
/** "cty" (Content Type) Header Parameter. */
/** "cty" (Content Type) Header Parameter */
cty?: string

@@ -315,3 +320,7 @@ }

export interface JWSHeaderParameters extends JoseHeaderParameters {
/** JWS "alg" (Algorithm) Header Parameter. */
/**
* JWS "alg" (Algorithm) Header Parameter
*
* @see {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}
*/
alg?: string

@@ -325,3 +334,3 @@

/** JWS "crit" (Critical) Header Parameter. */
/** JWS "crit" (Critical) Header Parameter */
crit?: string[]

@@ -419,9 +428,17 @@

export interface JWEHeaderParameters extends JoseHeaderParameters {
/** JWE "alg" (Algorithm) Header Parameter. */
/**
* JWE "alg" (Algorithm) Header Parameter
*
* @see {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}
*/
alg?: string
/** JWE "enc" (Encryption Algorithm) Header Parameter. */
/**
* JWE "enc" (Encryption Algorithm) Header Parameter
*
* @see {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}
*/
enc?: string
/** JWE "crit" (Critical) Header Parameter. */
/** JWE "crit" (Critical) Header Parameter */
crit?: string[]

@@ -428,0 +445,0 @@

/**
* Utility function to encode a string or Uint8Array as a base64url string.
* Utility function to encode a string or {@link !Uint8Array} as a base64url string.
*

@@ -4,0 +4,0 @@ * @param input Value that will be base64url-encoded.

{
"name": "jose",
"version": "5.9.2",
"version": "5.9.3",
"description": "JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes",

@@ -5,0 +5,0 @@ "keywords": [

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