Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jose-node-esm-runtime

Package Overview
Dependencies
Maintainers
1
Versions
132
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jose-node-esm-runtime - npm Package Compare versions

Comparing version 4.4.0 to 4.5.0

dist/node/esm/util/decode_jwt.js

1

dist/node/esm/index.js

@@ -25,2 +25,3 @@ export { compactDecrypt } from './jwe/compact/decrypt.js';

export { decodeProtectedHeader } from './util/decode_protected_header.js';
export { decodeJwt } from './util/decode_jwt.js';
export * as errors from './util/errors.js';

@@ -27,0 +28,0 @@ export { generateKeyPair } from './key/generate_key_pair.js';

26

dist/node/esm/jwks/local.js

@@ -41,13 +41,10 @@ import { importJWK } from '../key/import.js';

async getKey(protectedHeader, token) {
const joseHeader = {
...protectedHeader,
...token.header,
};
const { alg, kid } = { ...protectedHeader, ...token.header };
const candidates = this._jwks.keys.filter((jwk) => {
let candidate = jwk.kty === getKtyFromAlg(joseHeader.alg);
if (candidate && typeof joseHeader.kid === 'string') {
candidate = joseHeader.kid === jwk.kid;
let candidate = jwk.kty === getKtyFromAlg(alg);
if (candidate && typeof kid === 'string') {
candidate = kid === jwk.kid;
}
if (candidate && typeof jwk.alg === 'string') {
candidate = joseHeader.alg === jwk.alg;
candidate = alg === jwk.alg;
}

@@ -60,7 +57,7 @@ if (candidate && typeof jwk.use === 'string') {

}
if (candidate && joseHeader.alg === 'EdDSA') {
if (candidate && alg === 'EdDSA') {
candidate = jwk.crv === 'Ed25519' || jwk.crv === 'Ed448';
}
if (candidate) {
switch (joseHeader.alg) {
switch (alg) {
case 'ES256':

@@ -78,3 +75,2 @@ candidate = jwk.crv === 'P-256';

break;
default:
}

@@ -92,10 +88,10 @@ }

const cached = this._cached.get(jwk) || this._cached.set(jwk, {}).get(jwk);
if (cached[joseHeader.alg] === undefined) {
const keyObject = await importJWK({ ...jwk, ext: true }, joseHeader.alg);
if (cached[alg] === undefined) {
const keyObject = await importJWK({ ...jwk, ext: true }, alg);
if (keyObject instanceof Uint8Array || keyObject.type !== 'public') {
throw new JWKSInvalid('JSON Web Key Set members must be public keys');
}
cached[joseHeader.alg] = keyObject;
cached[alg] = keyObject;
}
return cached[joseHeader.alg];
return cached[alg];
}

@@ -102,0 +98,0 @@ }

import fetchJwks from '../runtime/fetch_jwks.js';
import { isCloudflareWorkers } from '../runtime/env.js';
import { JWKSInvalid, JWKSNoMatchingKey } from '../util/errors.js';

@@ -42,2 +43,15 @@ import { isJWKSLike, LocalJWKSet } from './local.js';

async reload() {
if (this._pendingFetch && isCloudflareWorkers()) {
return new Promise((resolve) => {
const isDone = () => {
if (this._pendingFetch === undefined) {
resolve();
}
else {
setTimeout(isDone, 5);
}
};
isDone();
});
}
if (!this._pendingFetch) {

@@ -44,0 +58,0 @@ this._pendingFetch = fetchJwks(this._url, this._timeoutDuration, this._options)

import { Buffer } from 'buffer';
import { decoder } from '../lib/buffer_utils.js';
let encodeImpl;
let encode;
function normalize(input) {

@@ -12,10 +12,10 @@ let encoded = input;

if (Buffer.isEncoding('base64url')) {
encodeImpl = (input) => Buffer.from(input).toString('base64url');
encode = (input) => Buffer.from(input).toString('base64url');
}
else {
encodeImpl = (input) => Buffer.from(input).toString('base64').replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
encode = (input) => Buffer.from(input).toString('base64').replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
}
export const decodeBase64 = (input) => Buffer.from(input, 'base64');
export const encodeBase64 = (input) => Buffer.from(input).toString('base64');
export const encode = encodeImpl;
export { encode };
export const decode = (input) => Buffer.from(normalize(input), 'base64');

@@ -39,2 +39,3 @@ export { compactDecrypt } from './jwe/compact/decrypt';

export { decodeProtectedHeader } from './util/decode_protected_header';
export { decodeJwt } from './util/decode_jwt';
export type { ProtectedHeaderParameters } from './util/decode_protected_header';

@@ -41,0 +42,0 @@ export * as errors from './util/errors';

{
"name": "jose-node-esm-runtime",
"version": "4.4.0",
"version": "4.5.0",
"homepage": "https://github.com/panva/jose",

@@ -5,0 +5,0 @@ "repository": "panva/jose",

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