Socket
Socket
Sign inDemoInstall

jose

Package Overview
Dependencies
Maintainers
1
Versions
209
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 4.8.1 to 4.8.3

7

dist/browser/lib/crypto_key.js

@@ -1,2 +0,2 @@

import { isCloudflareWorkers, isNodeJs } from '../runtime/env.js';
import { isCloudflareWorkers } from '../runtime/env.js';
function unusable(name, prop = 'algorithm.name') {

@@ -74,7 +74,2 @@ return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);

}
case isNodeJs() && 'EdDSA': {
if (key.algorithm.name !== 'NODE-ED25519' && key.algorithm.name !== 'NODE-ED448')
throw unusable('NODE-ED25519 or NODE-ED448');
break;
}
case isCloudflareWorkers() && 'EdDSA': {

@@ -81,0 +76,0 @@ if (!isAlgorithm(key.algorithm, 'NODE-ED25519'))

8

dist/browser/runtime/asn1.js

@@ -1,2 +0,2 @@

import { isCloudflareWorkers, isNodeJs } from './env.js';
import { isCloudflareWorkers } from './env.js';
import crypto, { isCryptoKey } from './webcrypto.js';

@@ -47,6 +47,4 @@ import invalidKeyInput from '../lib/invalid_key_input.js';

return 'P-521';
case (isCloudflareWorkers() || isNodeJs()) && findOid(keyData, [0x2b, 0x65, 0x70]):
case isCloudflareWorkers() && findOid(keyData, [0x2b, 0x65, 0x70]):
return 'Ed25519';
case isNodeJs() && findOid(keyData, [0x2b, 0x65, 0x71]):
return 'Ed448';
default:

@@ -106,3 +104,3 @@ throw new JOSENotSupported('Invalid or unsupported EC Key Curve or OKP Key Sub Type');

break;
case (isCloudflareWorkers() || isNodeJs()) && 'EdDSA':
case isCloudflareWorkers() && 'EdDSA':
const namedCurve = getNamedCurve(keyData).toUpperCase();

@@ -109,0 +107,0 @@ algorithm = { name: `NODE-${namedCurve}`, namedCurve: `NODE-${namedCurve}` };

export function isCloudflareWorkers() {
return typeof WebSocketPair === 'function';
}
export function isNodeJs() {
try {
return process.versions.node !== undefined;
}
catch (_a) {
return false;
}
}

@@ -1,2 +0,2 @@

import { isCloudflareWorkers, isNodeJs } from './env.js';
import { isCloudflareWorkers } from './env.js';
import crypto from './webcrypto.js';

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

break;
case (isCloudflareWorkers() || isNodeJs()) && 'EdDSA':
case isCloudflareWorkers() && 'EdDSA':
switch (options === null || options === void 0 ? void 0 : options.crv) {

@@ -112,8 +112,4 @@ case undefined:

break;
case isNodeJs() && 'Ed448':
algorithm = { name: 'NODE-ED448', namedCurve: 'NODE-ED448' };
keyUsages = ['sign', 'verify'];
break;
default:
throw new JOSENotSupported('Invalid or unsupported crv option provided, supported values are Ed25519 and Ed448');
throw new JOSENotSupported('Invalid or unsupported crv option provided');
}

@@ -120,0 +116,0 @@ break;

@@ -1,2 +0,2 @@

import { isCloudflareWorkers, isNodeJs } from './env.js';
import { isCloudflareWorkers } from './env.js';
import crypto from './webcrypto.js';

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

}
case (isCloudflareWorkers() || isNodeJs()) && 'OKP':
case isCloudflareWorkers() && 'OKP':
if (jwk.alg !== 'EdDSA') {

@@ -112,6 +112,2 @@ throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');

break;
case isNodeJs() && 'Ed448':
algorithm = { name: 'NODE-ED448', namedCurve: 'NODE-ED448' };
keyUsages = jwk.d ? ['sign'] : ['verify'];
break;
default:

@@ -118,0 +114,0 @@ throw new JOSENotSupported('Invalid or unsupported JWK "crv" (Subtype of Key Pair) Parameter value');

@@ -1,2 +0,2 @@

import { isCloudflareWorkers, isNodeJs } from './env.js';
import { isCloudflareWorkers } from './env.js';
import { JOSENotSupported } from '../util/errors.js';

@@ -22,3 +22,3 @@ export default function subtleDsa(alg, algorithm) {

return { hash, name: 'ECDSA', namedCurve: algorithm.namedCurve };
case (isCloudflareWorkers() || isNodeJs()) && 'EdDSA':
case isCloudflareWorkers() && 'EdDSA':
const { namedCurve } = algorithm;

@@ -25,0 +25,0 @@ return { name: namedCurve, namedCurve };

@@ -77,7 +77,2 @@ "use strict";

}
case (0, env_js_1.isNodeJs)() && 'EdDSA': {
if (key.algorithm.name !== 'NODE-ED25519' && key.algorithm.name !== 'NODE-ED448')
throw unusable('NODE-ED25519 or NODE-ED448');
break;
}
case (0, env_js_1.isCloudflareWorkers)() && 'EdDSA': {

@@ -84,0 +79,0 @@ if (!isAlgorithm(key.algorithm, 'NODE-ED25519'))

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isNodeJs = exports.isCloudflareWorkers = void 0;
exports.isCloudflareWorkers = void 0;
function isCloudflareWorkers() {

@@ -8,5 +8,1 @@ return false;

exports.isCloudflareWorkers = isCloudflareWorkers;
function isNodeJs() {
return true;
}
exports.isNodeJs = isNodeJs;

@@ -1,2 +0,2 @@

import { isCloudflareWorkers, isNodeJs } from '../runtime/env.js';
import { isCloudflareWorkers } from '../runtime/env.js';
function unusable(name, prop = 'algorithm.name') {

@@ -74,7 +74,2 @@ return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);

}
case isNodeJs() && 'EdDSA': {
if (key.algorithm.name !== 'NODE-ED25519' && key.algorithm.name !== 'NODE-ED448')
throw unusable('NODE-ED25519 or NODE-ED448');
break;
}
case isCloudflareWorkers() && 'EdDSA': {

@@ -81,0 +76,0 @@ if (!isAlgorithm(key.algorithm, 'NODE-ED25519'))

export function isCloudflareWorkers() {
return false;
}
export function isNodeJs() {
return true;
}
import type { JWK, KeyLike } from '../types';
/**
* Exports a runtime-specific public key representation (KeyObject or CryptoKey) to an PEM-encoded SPKI string format.
* Exports a runtime-specific public key representation (KeyObject or CryptoKey) to a PEM-encoded SPKI string format.
*
* @param key Key representation to transform to an PEM-encoded SPKI string format.
* @param key Key representation to transform to a PEM-encoded SPKI string format.
*

@@ -16,5 +16,5 @@ * @example Usage

/**
* Exports a runtime-specific private key representation (KeyObject or CryptoKey) to an PEM-encoded PKCS8 string format.
* Exports a runtime-specific private key representation (KeyObject or CryptoKey) to a PEM-encoded PKCS8 string format.
*
* @param key Key representation to transform to an PEM-encoded PKCS8 string format.
* @param key Key representation to transform to a PEM-encoded PKCS8 string format.
*

@@ -21,0 +21,0 @@ * @example Usage

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

/**
* Imports an 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 (KeyObject or CryptoKey).
* See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210) to learn about key to algorithm

@@ -56,3 +56,3 @@ * requirements and mapping.

/**
* Imports an PEM-encoded PKCS8 string as a runtime-specific private key representation (KeyObject or CryptoKey).
* Imports a PEM-encoded PKCS8 string as a runtime-specific private key representation (KeyObject or CryptoKey).
* See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210) to learn about key to algorithm

@@ -59,0 +59,0 @@ * requirements and mapping. Encrypted keys are not supported.

{
"name": "jose",
"version": "4.8.1",
"version": "4.8.3",
"description": "'JSON Web Almost Everything' - JWA, JWS, JWE, JWT, JWK, JWKS with no dependencies using runtime's native crypto",

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

@@ -22,6 +22,4 @@ # jose

## Support
## [💗 Help the project](https://github.com/sponsors/panva)
If you or your business use `jose`, please consider becoming a [sponsor][support-sponsor] so I can continue maintaining it and adding new features carefree.
## Documentation

@@ -28,0 +26,0 @@

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