cose-kit
Version:
**DEPRECATED:** Use [@auth0/cose](https://www.npmjs.com/package/@auth0/cose).
238 lines (237 loc) • 5.6 kB
TypeScript
import { KeyLike } from "jose";
/**
* A generic Error that all other COSE specific Error subclasses extend.
*
* @example Checking thrown error is a COSE one
*
* ```js
* if (err instanceof cose.errors.COSEError) {
* // ...
* }
* ```
*/
export declare class COSEError extends Error {
/** A unique error code for the particular error subclass. */
static get code(): string;
/** A unique error code for the particular error subclass. */
code: string;
constructor(message?: string);
}
/**
* An error subclass thrown when a JOSE Algorithm is not allowed per developer preference.
*
* @example Checking thrown error is this one using a stable error code
*
* ```js
* if (err.code === 'ERR_COSE_ALG_NOT_ALLOWED') {
* // ...
* }
* ```
*
* @example Checking thrown error is this one using `instanceof`
*
* ```js
* if (err instanceof jose.errors.JOSEAlgNotAllowed) {
* // ...
* }
* ```
*/
export declare class COSEAlgNotAllowed extends COSEError {
static get code(): 'ERR_COSE_ALG_NOT_ALLOWED';
code: string;
}
/**
* An error subclass thrown when a particular feature or algorithm is not supported by this
* implementation or JOSE in general.
*
* @example Checking thrown error is this one using a stable error code
*
* ```js
* if (err.code === 'ERR_COSE_NOT_SUPPORTED') {
* // ...
* }
* ```
*
* @example Checking thrown error is this one using `instanceof`
*
* ```js
* if (err instanceof jose.errors.JOSENotSupported) {
* // ...
* }
* ```
*/
export declare class COSENotSupported extends COSEError {
static get code(): 'ERR_COSE_NOT_SUPPORTED';
code: string;
}
/**
* An error subclass thrown when a JWKS is invalid.
*
* @example Checking thrown error is this one using a stable error code
*
* ```js
* if (err.code === 'ERR_JWKS_INVALID') {
* // ...
* }
* ```
*
* @example Checking thrown error is this one using `instanceof`
*
* ```js
* if (err instanceof jose.errors.JWKSInvalid) {
* // ...
* }
* ```
*/
export declare class JWKSInvalid extends COSEError {
static get code(): 'ERR_JWKS_INVALID';
code: string;
}
/**
* An error subclass thrown when no keys match from a JWKS.
*
* @example Checking thrown error is this one using a stable error code
*
* ```js
* if (err.code === 'ERR_JWKS_NO_MATCHING_KEY') {
* // ...
* }
* ```
*
* @example Checking thrown error is this one using `instanceof`
*
* ```js
* if (err instanceof jose.errors.JWKSNoMatchingKey) {
* // ...
* }
* ```
*/
export declare class JWKSNoMatchingKey extends COSEError {
static get code(): 'ERR_JWKS_NO_MATCHING_KEY';
code: string;
message: string;
}
/**
* An error subclass thrown when multiple keys match from a JWKS.
*
* @example Checking thrown error is this one using a stable error code
*
* ```js
* if (err.code === 'ERR_JWKS_MULTIPLE_MATCHING_KEYS') {
* // ...
* }
* ```
*
* @example Checking thrown error is this one using `instanceof`
*
* ```js
* if (err instanceof jose.errors.JWKSMultipleMatchingKeys) {
* // ...
* }
* ```
*/
export declare class JWKSMultipleMatchingKeys extends COSEError {
/** @ignore */
[Symbol.asyncIterator]: () => AsyncIterableIterator<KeyLike>;
static get code(): 'ERR_JWKS_MULTIPLE_MATCHING_KEYS';
code: string;
message: string;
}
export declare class X509NoMatchingCertificate extends COSEError {
static get code(): 'ERR_X509_NO_MATCHING_CERTIFICATE';
code: string;
message: string;
}
export declare class X509InvalidCertificateChain extends COSEError {
static get code(): 'ERR_X509_INVALID_CERTIFICATE_CHAIN';
code: string;
}
/**
* An error subclass thrown when a COSE ciphertext decryption fails.
*
* @example
*
* Checking thrown error is this one using a stable error code
*
* ```js
* if (err.code === 'ERR_COSE_DECRYPTION_FAILED') {
* // ...
* }
* ```
*
* @example
*
* Checking thrown error is this one using `instanceof`
*
* ```js
* if (err instanceof jose.errors.COSEDecryptionFailed) {
* // ...
* }
* ```
*/
export declare class COSEDecryptionFailed extends COSEError {
/** @ignore */
static get code(): 'ERR_COSE_DECRYPTION_FAILED';
code: string;
message: string;
}
/**
* An error subclass thrown when an encrypted COSE is invalid.
*
* @example
*
* Checking thrown error is this one using a stable error code
*
* ```js
* if (err.code === 'ERR_COSE_ENCRYPTED_INVALID') {
* // ...
* }
* ```
*
* @example
*
* Checking thrown error is this one using `instanceof`
*
* ```js
* if (err instanceof jose.errors.COSEEncryptedInvalid) {
* // ...
* }
* ```
*/
export declare class COSEEncryptedInvalid extends COSEError {
/** @ignore */
static get code(): 'ERR_COSE_ENCRYPTED_INVALID';
code: string;
}
/**
* An error subclass thrown when the COSE message is invalid.
*/
export declare class COSEInvalid extends COSEError {
/** @ignore */
static get code(): 'ERR_COSE_INVALID';
code: string;
}
/**
* An error subclass thrown when COSE signature verification fails.
*
* @example Checking thrown error is this one using a stable error code
*
* ```js
* if (err.code === 'ERR_COSE_SIGNATURE_VERIFICATION_FAILED') {
* // ...
* }
* ```
*
* @example Checking thrown error is this one using `instanceof`
*
* ```js
* if (err instanceof jose.errors.COSESignatureVerificationFailed) {
* // ...
* }
* ```
*/
export declare class COSESignatureVerificationFailed extends COSEError {
static get code(): 'ERR_COSE_SIGNATURE_VERIFICATION_FAILED';
code: string;
message: string;
}