anon-identity
Version:
Decentralized identity framework with DIDs, Verifiable Credentials, and privacy-preserving selective disclosure
93 lines • 3.09 kB
TypeScript
import { CredentialStatus } from '../types/vc2';
import { DID } from '../types';
/**
* Interface for credential status checking
*/
export interface CredentialStatusChecker {
/**
* Check if a credential is revoked or suspended
* @param credentialId The credential ID to check
* @param statusInfo The credential status information
* @returns Status check result
*/
checkStatus(credentialId: string, statusInfo: CredentialStatus): Promise<StatusCheckResult>;
}
export interface StatusCheckResult {
revoked: boolean;
suspended?: boolean;
reason?: string;
statusListIndex?: number;
checkedAt: string;
}
/**
* RevocationList2020 status checker
* Compatible with existing revocation implementation
*/
export declare class RevocationList2020StatusChecker implements CredentialStatusChecker {
private revocationLists;
constructor(revocationLists?: Map<string, any>);
checkStatus(credentialId: string, statusInfo: CredentialStatus): Promise<StatusCheckResult>;
/**
* Add or update a revocation list
*/
addRevocationList(listId: string, list: any): void;
}
/**
* StatusList2021 implementation
* Uses a bitstring to efficiently store credential status
*/
export declare class StatusList2021 {
private bitstring;
private size;
constructor(size?: number);
/**
* Set status for a credential at given index
* @param index The index in the status list
* @param revoked Whether the credential is revoked
*/
setStatus(index: number, revoked: boolean): void;
/**
* Check status for a credential at given index
* @param index The index in the status list
* @returns Whether the credential is revoked
*/
getStatus(index: number): boolean;
/**
* Encode the bitstring as base64
*/
encode(): string;
/**
* Decode from base64
*/
static decode(encoded: string, size: number): StatusList2021;
/**
* Create a signed status list credential
*/
createStatusListCredential(issuerDID: DID, privateKey: Uint8Array, listId: string): Promise<any>;
}
/**
* StatusList2021 status checker
*/
export declare class StatusList2021StatusChecker implements CredentialStatusChecker {
private statusLists;
constructor(statusLists?: Map<string, StatusList2021>);
checkStatus(credentialId: string, statusInfo: CredentialStatus): Promise<StatusCheckResult>;
/**
* Add or update a status list
*/
addStatusList(listId: string, list: StatusList2021): void;
/**
* Load a status list from a credential
*/
loadStatusListCredential(credential: any): Promise<void>;
}
/**
* Composite status checker that supports multiple status types
*/
export declare class CompositeStatusChecker implements CredentialStatusChecker {
private checkers;
constructor();
registerChecker(type: string, checker: CredentialStatusChecker): void;
checkStatus(credentialId: string, statusInfo: CredentialStatus): Promise<StatusCheckResult>;
}
//# sourceMappingURL=credential-status.d.ts.map