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

jose-browser-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-browser-runtime - 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 };

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-browser-runtime",
"version": "4.8.1",
"version": "4.8.3",
"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