anon-identity
Version:
Decentralized identity framework with DIDs, Verifiable Credentials, and privacy-preserving selective disclosure
63 lines • 2.81 kB
TypeScript
export declare enum VerificationErrorCode {
EXPIRED_CREDENTIAL = "EXPIRED_CREDENTIAL",
REVOKED_CREDENTIAL = "REVOKED_CREDENTIAL",
UNTRUSTED_ISSUER = "UNTRUSTED_ISSUER",
INVALID_SIGNATURE = "INVALID_SIGNATURE",
MISSING_REQUIRED_ATTRIBUTE = "MISSING_REQUIRED_ATTRIBUTE",
INVALID_DISCLOSURE_PROOF = "INVALID_DISCLOSURE_PROOF",
MISSING_PROOF = "MISSING_PROOF",
INVALID_PRESENTATION_SIGNATURE = "INVALID_PRESENTATION_SIGNATURE",
INVALID_CREDENTIAL_FORMAT = "INVALID_CREDENTIAL_FORMAT",
NETWORK_ERROR = "NETWORK_ERROR",
STORAGE_ERROR = "STORAGE_ERROR",
CREDENTIAL_SUSPENDED = "CREDENTIAL_SUSPENDED",
INVALID_CREDENTIAL = "INVALID_CREDENTIAL",
INSUFFICIENT_PERMISSIONS = "INSUFFICIENT_PERMISSIONS",
CREDENTIAL_REVOKED = "CREDENTIAL_REVOKED",
PROCESSING_ERROR = "PROCESSING_ERROR"
}
export interface VerificationErrorDetails {
credentialId?: string;
issuer?: string;
attribute?: string;
expectedValue?: any;
actualValue?: any;
timestamp?: Date;
[key: string]: any;
}
export declare class VerificationError extends Error {
readonly code: VerificationErrorCode;
readonly details: VerificationErrorDetails;
constructor(code: VerificationErrorCode, message: string, details?: VerificationErrorDetails);
/**
* Create a standardized error message
*/
toString(): string;
/**
* Convert to JSON for API responses
*/
toJSON(): Record<string, any>;
/**
* Factory methods for common errors
*/
static expiredCredential(credentialId: string, issuer: string): VerificationError;
static revokedCredential(credentialId: string, issuer: string): VerificationError;
static untrustedIssuer(issuer: string, credentialId: string): VerificationError;
static invalidSignature(credentialId: string, reason?: string): VerificationError;
static missingRequiredAttribute(attribute: string, credentialId?: string): VerificationError;
static invalidDisclosureProof(credentialId: string): VerificationError;
static missingProof(type: 'presentation' | 'credential', id?: string): VerificationError;
static invalidPresentationSignature(reason?: string): VerificationError;
static invalidCredentialFormat(credentialId: string, reason?: string): VerificationError;
static networkError(operation: string, error: Error): VerificationError;
static storageError(operation: string, error: Error): VerificationError;
}
/**
* Helper to determine if an error is a VerificationError
*/
export declare function isVerificationError(error: unknown): error is VerificationError;
/**
* Helper to get error code from any error
*/
export declare function getErrorCode(error: unknown): VerificationErrorCode | null;
//# sourceMappingURL=verification-errors.d.ts.map