Comparing version 1.18.1 to 1.18.2
@@ -5,2 +5,13 @@ # Change Log | ||
## [1.18.2](https://github.com/panva/jose/compare/v1.18.1...v1.18.2) (2020-01-08) | ||
### Bug Fixes | ||
* ensure asn1.js version to remove Buffer deprecation notice ([13b1106](https://github.com/panva/jose/commit/13b1106048fdeae00b09d54f05245dded85b14a7)) | ||
* expose JOSENotSupported key import errors on unsupported runtimes ([bc81e5d](https://github.com/panva/jose/commit/bc81e5dec2987f6ce6dc3fa5daa23dfe620c0a34)) | ||
* typo in JOSENotSupported error when x509 certs are not supported ([bb58c9c](https://github.com/panva/jose/commit/bb58c9ce52e807ca4cfad6bcbf1ab96b91778b1f)) | ||
## [1.18.1](https://github.com/panva/jose/compare/v1.18.0...v1.18.1) (2020-01-01) | ||
@@ -7,0 +18,0 @@ |
@@ -35,3 +35,23 @@ let { createPublicKey, createPrivateKey, createSecretKey, KeyObject } = require('crypto') | ||
const derToPem = (der, label) => `-----BEGIN ${label}-----${EOL}${der.toString('base64').match(/.{1,64}/g).join(EOL)}${EOL}-----END ${label}-----` | ||
const unsupported = (label) => { | ||
switch (label) { | ||
case '1.3.101.110': | ||
label = 'X25519' | ||
break | ||
case '1.3.101.111': | ||
label = 'X448' | ||
break | ||
case '1.3.101.112': | ||
label = 'Ed25519' | ||
break | ||
case '1.3.101.113': | ||
label = 'Ed448' | ||
break | ||
default: | ||
label = `OID ${label}` | ||
} | ||
throw new errors.JOSENotSupported(`${label} is not supported in your Node.js runtime version`) | ||
} | ||
KeyObject = class KeyObject { | ||
@@ -278,3 +298,3 @@ export ({ cipher, passphrase, type, format } = {}) { | ||
case '-----BEGIN CERTIFICATE-----': | ||
throw new errors.JOSENotSupported('X.509 certificates are supported in your Node.js runtime version') | ||
throw new errors.JOSENotSupported('X.509 certificates are not supported in your Node.js runtime version') | ||
default: | ||
@@ -291,3 +311,4 @@ throw new TypeError('unknown/unsupported PEM type') | ||
let type, keyObject | ||
switch (parsed.algorithm.algorithm.join('.')) { | ||
const oid = parsed.algorithm.algorithm.join('.') | ||
switch (oid) { | ||
case '1.2.840.10045.2.1': { | ||
@@ -308,3 +329,3 @@ keyObject = new KeyObject() | ||
default: | ||
throw new errors.JOSENotSupported(`OID ${parsed.algorithm.algorithm.join('.')} is not supported in your Node.js runtime version`) | ||
unsupported(oid) | ||
} | ||
@@ -382,3 +403,4 @@ | ||
let type, keyObject | ||
switch (parsed.algorithm.algorithm.join('.')) { | ||
const oid = parsed.algorithm.algorithm.join('.') | ||
switch (oid) { | ||
case '1.2.840.10045.2.1': { | ||
@@ -396,3 +418,3 @@ const OID = asn1.get('OID') | ||
default: | ||
throw new errors.JOSENotSupported(`OID ${parsed.algorithm.algorithm.join('.')} is not supported in your Node.js runtime version`) | ||
unsupported(oid) | ||
} | ||
@@ -399,0 +421,0 @@ |
@@ -30,2 +30,3 @@ const { deflateRawSync } = require('zlib') | ||
class Encrypt { | ||
// TODO: in v2.x swap unprotectedHeader and aad | ||
constructor (cleartext, protectedHeader, unprotectedHeader, aad) { | ||
@@ -32,0 +33,0 @@ if (!Buffer.isBuffer(cleartext) && typeof cleartext !== 'string') { |
const Encrypt = require('./encrypt') | ||
const decrypt = require('./decrypt') | ||
// TODO: in v2.x swap unprotectedHeader and aad | ||
const single = (serialization, cleartext, key, protectedHeader, unprotectedHeader, aad) => { | ||
@@ -5,0 +6,0 @@ const jwe = new Encrypt(cleartext, protectedHeader, unprotectedHeader, aad) |
@@ -89,3 +89,7 @@ const { deprecate } = require('util') | ||
privateKey = createPrivateKey(key) | ||
} catch (err) {} | ||
} catch (err) { | ||
if (err instanceof errors.JOSEError) { | ||
throw err | ||
} | ||
} | ||
@@ -99,3 +103,7 @@ try { | ||
} | ||
} catch (err) {} | ||
} catch (err) { | ||
if (err instanceof errors.JOSEError) { | ||
throw err | ||
} | ||
} | ||
@@ -102,0 +110,0 @@ try { |
@@ -282,3 +282,3 @@ const isObject = require('../help/is_object') | ||
if (age - tolerance > max || age < 0 - tolerance) { | ||
if (age < 0 - tolerance) { | ||
throw new JWTClaimInvalid('"iat" claim timestamp check failed (it should be in the past)') | ||
@@ -285,0 +285,0 @@ } |
{ | ||
"name": "jose", | ||
"version": "1.18.1", | ||
"version": "1.18.2", | ||
"description": "JSON Web Almost Everything - JWA, JWS, JWE, JWK, JWT, JWKS for Node.js with minimal dependencies", | ||
@@ -71,12 +71,12 @@ "keywords": [ | ||
"dependencies": { | ||
"asn1.js": "^5.2.0" | ||
"asn1.js": "^5.3.0" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^8.2.0", | ||
"@commitlint/config-conventional": "^8.2.0", | ||
"@commitlint/cli": "^8.3.4", | ||
"@commitlint/config-conventional": "^8.3.4", | ||
"ava": "^2.4.0", | ||
"babel-eslint": "^10.0.3", | ||
"c8": "^7.0.0", | ||
"dtslint": "^2.0.0", | ||
"husky": "^3.0.9", | ||
"dtslint": "^2.0.5", | ||
"husky": "^4.0.0", | ||
"standard": "^14.3.1" | ||
@@ -83,0 +83,0 @@ }, |
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
221970
4777
Updatedasn1.js@^5.3.0