UNPKG

jose

Version:

Universal 'JSON Web Almost Everything' - JWA, JWS, JWE, JWT, JWK with no dependencies

112 lines (111 loc) 3.64 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.JWTExpired = exports.JWSSignatureVerificationFailed = exports.JWKSMultipleMatchingKeys = exports.JWKSNoMatchingKey = exports.JWKSInvalid = exports.JWKInvalid = exports.JWTInvalid = exports.JWSInvalid = exports.JWEInvalid = exports.JWEDecryptionFailed = exports.JOSENotSupported = exports.JOSEAlgNotAllowed = exports.JWTClaimValidationFailed = exports.JOSEError = void 0; class JOSEError extends Error { constructor(message) { super(message); this.code = 'ERR_JOSE_GENERIC'; this.name = this.constructor.name; if (Error.captureStackTrace) { Error.captureStackTrace(this, this.constructor); } } } exports.JOSEError = JOSEError; class JWTClaimValidationFailed extends JOSEError { constructor(message, claim = 'unspecified', reason = 'unspecified') { super(message); this.code = 'ERR_JWT_CLAIM_VALIDATION_FAILED'; this.claim = claim; this.reason = reason; } } exports.JWTClaimValidationFailed = JWTClaimValidationFailed; class JOSEAlgNotAllowed extends JOSEError { constructor() { super(...arguments); this.code = 'ERR_JOSE_ALG_NOT_ALLOWED'; } } exports.JOSEAlgNotAllowed = JOSEAlgNotAllowed; class JOSENotSupported extends JOSEError { constructor() { super(...arguments); this.code = 'ERR_JOSE_NOT_SUPPORTED'; } } exports.JOSENotSupported = JOSENotSupported; class JWEDecryptionFailed extends JOSEError { constructor() { super(...arguments); this.code = 'ERR_JWE_DECRYPTION_FAILED'; this.message = 'decryption operation failed'; } } exports.JWEDecryptionFailed = JWEDecryptionFailed; class JWEInvalid extends JOSEError { constructor() { super(...arguments); this.code = 'ERR_JWE_INVALID'; } } exports.JWEInvalid = JWEInvalid; class JWSInvalid extends JOSEError { constructor() { super(...arguments); this.code = 'ERR_JWS_INVALID'; } } exports.JWSInvalid = JWSInvalid; class JWTInvalid extends JOSEError { constructor() { super(...arguments); this.code = 'ERR_JWT_INVALID'; } } exports.JWTInvalid = JWTInvalid; class JWKInvalid extends JOSEError { constructor() { super(...arguments); this.code = 'ERR_JWK_INVALID'; } } exports.JWKInvalid = JWKInvalid; class JWKSInvalid extends JOSEError { constructor() { super(...arguments); this.code = 'ERR_JWKS_INVALID'; } } exports.JWKSInvalid = JWKSInvalid; class JWKSNoMatchingKey extends JOSEError { constructor() { super(...arguments); this.code = 'ERR_JWKS_NO_MATCHING_KEY'; this.message = 'no applicable key found in the JSON Web Key Set'; } } exports.JWKSNoMatchingKey = JWKSNoMatchingKey; class JWKSMultipleMatchingKeys extends JOSEError { constructor() { super(...arguments); this.code = 'ERR_JWKS_MULTIPLE_MATCHING_KEYS'; this.message = 'multiple matching keys found in the JSON Web Key Set'; } } exports.JWKSMultipleMatchingKeys = JWKSMultipleMatchingKeys; class JWSSignatureVerificationFailed extends JOSEError { constructor() { super(...arguments); this.code = 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED'; this.message = 'signature verification failed'; } } exports.JWSSignatureVerificationFailed = JWSSignatureVerificationFailed; class JWTExpired extends JWTClaimValidationFailed { constructor() { super(...arguments); this.code = 'ERR_JWT_EXPIRED'; } } exports.JWTExpired = JWTExpired;