jose-node-esm-runtime
Advanced tools
Comparing version 4.11.1 to 4.11.2
@@ -1,8 +0,8 @@ | ||
import { isCryptoKey } from './webcrypto.js'; | ||
import webcrypto, { isCryptoKey } from './webcrypto.js'; | ||
import isKeyObject from './is_key_object.js'; | ||
export default (key) => isKeyObject(key) || isCryptoKey(key); | ||
const types = ['KeyObject']; | ||
if (parseInt(process.versions.node) >= 16) { | ||
if (globalThis.CryptoKey || (webcrypto === null || webcrypto === void 0 ? void 0 : webcrypto.CryptoKey)) { | ||
types.push('CryptoKey'); | ||
} | ||
export { types }; |
@@ -8,9 +8,5 @@ import { Buffer } from 'buffer'; | ||
import Asn1SequenceEncoder from './asn1_sequence_encoder.js'; | ||
const [major, minor] = process.version | ||
.slice(1) | ||
.split('.') | ||
.map((str) => parseInt(str, 10)); | ||
const jwkImportSupported = major >= 16 || (major === 15 && minor >= 12); | ||
import { jwkImport } from './flags.js'; | ||
const parse = (jwk) => { | ||
if (jwkImportSupported && jwk.kty !== 'oct') { | ||
if (jwkImport && jwk.kty !== 'oct') { | ||
return jwk.d | ||
@@ -17,0 +13,0 @@ ? createPrivateKey({ format: 'jwk', key: jwk }) |
@@ -10,7 +10,3 @@ import { KeyObject, createPublicKey } from 'crypto'; | ||
import { types } from './is_key_like.js'; | ||
const [major, minor] = process.version | ||
.slice(1) | ||
.split('.') | ||
.map((str) => parseInt(str, 10)); | ||
const jwkExportSupported = major >= 16 || (major === 15 && minor >= 9); | ||
import { jwkExport } from './flags.js'; | ||
const keyToJWK = (key) => { | ||
@@ -36,3 +32,3 @@ let keyObject; | ||
} | ||
if (jwkExportSupported) { | ||
if (jwkExport) { | ||
if (keyObject.type !== 'secret' && | ||
@@ -39,0 +35,0 @@ !['rsa', 'ec', 'ed25519', 'x25519', 'ed448', 'x448'].includes(keyObject.asymmetricKeyType)) { |
@@ -5,8 +5,3 @@ import { constants } from 'crypto'; | ||
import checkModulusLength from './check_modulus_length.js'; | ||
const [major, minor] = process.version | ||
.slice(1) | ||
.split('.') | ||
.map((str) => parseInt(str, 10)); | ||
const electron = 'electron' in process.versions; | ||
const rsaPssParams = !electron && (major >= 17 || (major === 16 && minor >= 9)); | ||
import { rsaPssParams } from './flags.js'; | ||
const PSS = { | ||
@@ -13,0 +8,0 @@ padding: constants.RSA_PKCS1_PSS_PADDING, |
@@ -7,9 +7,5 @@ import * as crypto from 'crypto'; | ||
import getVerifyKey from './get_sign_verify_key.js'; | ||
const [major, minor] = process.version | ||
.slice(1) | ||
.split('.') | ||
.map((str) => parseInt(str, 10)); | ||
const oneShotCallbackSupported = major >= 16 || (major === 15 && minor >= 13); | ||
import { oneShotCallback } from './flags.js'; | ||
let oneShotVerify; | ||
if (crypto.verify.length > 4 && oneShotCallbackSupported) { | ||
if (crypto.verify.length > 4 && oneShotCallback) { | ||
oneShotVerify = promisify(crypto.verify); | ||
@@ -16,0 +12,0 @@ } |
export class JOSEError extends Error { | ||
static get code() { | ||
return 'ERR_JOSE_GENERIC'; | ||
} | ||
constructor(message) { | ||
@@ -9,7 +12,7 @@ var _a; | ||
} | ||
} | ||
export class JWTClaimValidationFailed extends JOSEError { | ||
static get code() { | ||
return 'ERR_JOSE_GENERIC'; | ||
return 'ERR_JWT_CLAIM_VALIDATION_FAILED'; | ||
} | ||
} | ||
export class JWTClaimValidationFailed extends JOSEError { | ||
constructor(message, claim = 'unspecified', reason = 'unspecified') { | ||
@@ -21,7 +24,7 @@ super(message); | ||
} | ||
} | ||
export class JWTExpired extends JOSEError { | ||
static get code() { | ||
return 'ERR_JWT_CLAIM_VALIDATION_FAILED'; | ||
return 'ERR_JWT_EXPIRED'; | ||
} | ||
} | ||
export class JWTExpired extends JOSEError { | ||
constructor(message, claim = 'unspecified', reason = 'unspecified') { | ||
@@ -33,5 +36,2 @@ super(message); | ||
} | ||
static get code() { | ||
return 'ERR_JWT_EXPIRED'; | ||
} | ||
} | ||
@@ -38,0 +38,0 @@ export class JOSEAlgNotAllowed extends JOSEError { |
@@ -6,3 +6,3 @@ import type { FlattenedJWSInput, JWSHeaderParameters } from '../types'; | ||
* token's "jwk" (JSON Web Key) Header Parameter. It is recommended to combine this with the verify | ||
* algorithms option to whitelist JWS algorithms to accept. | ||
* function's `algorithms` option to define accepted JWS "alg" (Algorithm) Header Parameter values. | ||
* | ||
@@ -9,0 +9,0 @@ * @example Usage |
import type { JWSHeaderParameters, JWEHeaderParameters } from '../types'; | ||
export declare type ProtectedHeaderParameters = JWSHeaderParameters & JWEHeaderParameters; | ||
export type ProtectedHeaderParameters = JWSHeaderParameters & JWEHeaderParameters; | ||
/** | ||
@@ -4,0 +4,0 @@ * Decodes the Protected Header of a JWE/JWS/JWT token utilizing any JOSE serialization. |
{ | ||
"name": "jose-node-esm-runtime", | ||
"version": "4.11.1", | ||
"version": "4.11.2", | ||
"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
118
241312
6123