cose-kit
Version:
This is an early prototype of a RFC8152 COSE library for node.js.
80 lines (79 loc) • 2.28 kB
JavaScript
export class COSEError extends Error {
static get code() {
return 'ERR_COSE_GENERIC';
}
constructor(message) {
var _a;
super(message);
this.code = 'ERR_COSE_GENERIC';
this.name = this.constructor.name;
(_a = Error.captureStackTrace) === null || _a === void 0 ? void 0 : _a.call(Error, this, this.constructor);
}
}
export class COSEAlgNotAllowed extends COSEError {
constructor() {
super(...arguments);
this.code = 'ERR_COSE_ALG_NOT_ALLOWED';
}
static get code() {
return 'ERR_COSE_ALG_NOT_ALLOWED';
}
}
export class COSENotSupported extends COSEError {
constructor() {
super(...arguments);
this.code = 'ERR_COSE_NOT_SUPPORTED';
}
static get code() {
return 'ERR_COSE_NOT_SUPPORTED';
}
}
export class JWKSInvalid extends COSEError {
constructor() {
super(...arguments);
this.code = 'ERR_JWKS_INVALID';
}
static get code() {
return 'ERR_JWKS_INVALID';
}
}
export class JWKSNoMatchingKey extends COSEError {
constructor() {
super(...arguments);
this.code = 'ERR_JWKS_NO_MATCHING_KEY';
this.message = 'no applicable key found in the JSON Web Key Set';
}
static get code() {
return 'ERR_JWKS_NO_MATCHING_KEY';
}
}
export class JWKSMultipleMatchingKeys extends COSEError {
constructor() {
super(...arguments);
this.code = 'ERR_JWKS_MULTIPLE_MATCHING_KEYS';
this.message = 'multiple matching keys found in the JSON Web Key Set';
}
static get code() {
return 'ERR_JWKS_MULTIPLE_MATCHING_KEYS';
}
}
Symbol.asyncIterator;
export class X509NoMatchingCertificate extends COSEError {
constructor() {
super(...arguments);
this.code = 'ERR_X509_NO_MATCHING_CERTIFICATE';
this.message = 'no applicable certificate found in the COSE headers';
}
static get code() {
return 'ERR_X509_NO_MATCHING_CERTIFICATE';
}
}
export class X509InvalidCertificateChain extends COSEError {
constructor() {
super(...arguments);
this.code = 'ERR_X509_INVALID_CERTIFICATE_CHAIN';
}
static get code() {
return 'ERR_X509_INVALID_CERTIFICATE_CHAIN';
}
}