jose-node-esm-runtime
Advanced tools
Comparing version 4.9.3 to 4.10.0
@@ -36,14 +36,8 @@ import { decode as decodeBase64URL, encodeBase64, decodeBase64 } from '../runtime/base64url.js'; | ||
} | ||
else { | ||
let numberOfDigits = bytes[position] & 0x7f; | ||
position++; | ||
else if (length === 0x80) { | ||
length = 0; | ||
for (let i = 0; i < numberOfDigits; i++) { | ||
length = length * 256 + bytes[position]; | ||
position++; | ||
} | ||
} | ||
if (length === 0x80) { | ||
length = 0; | ||
while (bytes[position + length] !== 0 || bytes[position + length + 1] !== 0) { | ||
if (length > bytes.byteLength) { | ||
throw new TypeError('invalid indefinite form length'); | ||
} | ||
length++; | ||
@@ -58,2 +52,11 @@ } | ||
} | ||
else { | ||
let numberOfDigits = bytes[position] & 0x7f; | ||
position++; | ||
length = 0; | ||
for (let i = 0; i < numberOfDigits; i++) { | ||
length = length * 256 + bytes[position]; | ||
position++; | ||
} | ||
} | ||
const byteLength = position + length; | ||
@@ -85,3 +88,9 @@ return { | ||
} | ||
const spki = getSPKI(x509); | ||
let spki; | ||
try { | ||
spki = getSPKI(x509); | ||
} | ||
catch (cause) { | ||
throw new TypeError('failed to parse the X.509 certificate', { cause }); | ||
} | ||
return importPublic(spki, alg, options); | ||
@@ -88,0 +97,0 @@ } |
@@ -79,2 +79,8 @@ import { isCloudflareWorkers } from '../runtime/env.js'; | ||
} | ||
case 'EdDSA': { | ||
if (key.algorithm.name !== 'Ed25519' && key.algorithm.name !== 'Ed448') { | ||
throw unusable('Ed25519 or Ed448'); | ||
} | ||
break; | ||
} | ||
case 'ES256': | ||
@@ -120,6 +126,13 @@ case 'ES384': | ||
} | ||
case 'ECDH': | ||
if (!isAlgorithm(key.algorithm, 'ECDH')) | ||
throw unusable('ECDH'); | ||
case 'ECDH': { | ||
switch (key.algorithm.name) { | ||
case 'ECDH': | ||
case 'X25519': | ||
case 'X448': | ||
break; | ||
default: | ||
throw unusable('ECDH, X25519, or X448'); | ||
} | ||
break; | ||
} | ||
case 'PBES2-HS256+A128KW': | ||
@@ -126,0 +139,0 @@ case 'PBES2-HS384+A192KW': |
{ | ||
"name": "jose-node-esm-runtime", | ||
"version": "4.9.3", | ||
"version": "4.10.0", | ||
"homepage": "https://github.com/panva/jose", | ||
@@ -5,0 +5,0 @@ "repository": "panva/jose", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
233306
5955