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

14

dist/node/esm/lib/check_key_type.js

@@ -1,8 +0,8 @@

import invalidKeyInput from './invalid_key_input.js';
import { withAlg as invalidKeyInput } from './invalid_key_input.js';
import isKeyLike, { types } from '../runtime/is_key_like.js';
const symmetricTypeCheck = (key) => {
const symmetricTypeCheck = (alg, key) => {
if (key instanceof Uint8Array)
return;
if (!isKeyLike(key)) {
throw new TypeError(invalidKeyInput(key, ...types, 'Uint8Array'));
throw new TypeError(invalidKeyInput(alg, key, ...types, 'Uint8Array'));
}

@@ -13,5 +13,5 @@ if (key.type !== 'secret') {

};
const asymmetricTypeCheck = (key, usage) => {
const asymmetricTypeCheck = (alg, key, usage) => {
if (!isKeyLike(key)) {
throw new TypeError(invalidKeyInput(key, ...types));
throw new TypeError(invalidKeyInput(alg, key, ...types));
}

@@ -40,8 +40,8 @@ if (key.type === 'secret') {

if (symmetric) {
symmetricTypeCheck(key);
symmetricTypeCheck(alg, key);
}
else {
asymmetricTypeCheck(key, usage);
asymmetricTypeCheck(alg, key, usage);
}
};
export default checkKeyType;

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

export default (actual, ...types) => {
let msg = 'Key must be ';
function message(msg, actual, ...types) {
if (types.length > 2) {

@@ -25,2 +24,8 @@ const last = types.pop();

return msg;
}
export default (actual, ...types) => {
return message('Key must be ', actual, ...types);
};
export function withAlg(alg, actual, ...types) {
return message(`Key for the ${alg} algorithm must be `, actual, ...types);
}

@@ -20,4 +20,5 @@ import { JWEInvalid, JOSENotSupported } from '../util/errors.js';

if (cek instanceof Uint8Array) {
if (cek.length << 3 !== expected) {
throw new JWEInvalid('Invalid Content Encryption Key length');
const actual = cek.byteLength << 3;
if (actual !== expected) {
throw new JWEInvalid(`Invalid Content Encryption Key length. Expected ${expected} bits, got ${actual} bits`);
}

@@ -27,4 +28,5 @@ return;

if (isKeyObject(cek) && cek.type === 'secret') {
if (cek.symmetricKeySize << 3 !== expected) {
throw new JWEInvalid('Invalid Content Encryption Key length');
const actual = cek.symmetricKeySize << 3;
if (actual !== expected) {
throw new JWEInvalid(`Invalid Content Encryption Key length. Expected ${expected} bits, got ${actual} bits`);
}

@@ -31,0 +33,0 @@ return;

@@ -23,4 +23,4 @@ /**

* [CryptoKey](https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey) is a representation of a
* key/secret available in the Browser and Deno runtimes. In addition to the import functions of
* this library you may use the
* key/secret available in the Browser and Web-interoperable runtimes. In addition to the import
* functions of this library you may use the
* [SubtleCrypto.importKey](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey)

@@ -27,0 +27,0 @@ * API to obtain a CryptoKey from your existing key material.

{
"name": "jose-node-esm-runtime",
"version": "4.9.2",
"version": "4.9.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