/** * StatusList2021 Manager * * Manages StatusList2021 credentials for efficient delegation revocation. * Follows the Python POC design from Delegation-Revocation.md. * * SOLID Principles: * - Single Responsibility: Manages status list allocation and updates * - Open/Closed: Extensible via storage provider interface * - Liskov Substitution: Any storage provider can be used * - Interface Segregation: Minimal storage interface * - Dependency Inversion: Depends on abstractions (storage, signing) * * Related Spec: W3C StatusList2021 * Python Reference: Delegation-Revocation.md */ import type { StatusList2021Credential, CredentialStatus } from '@kya-os/contracts'; import { CompressionFunction, DecompressionFunction } from './bitstring'; import { VCSigningFunction } from './vc-issuer'; /** * Storage provider interface for status lists * * Platform-specific implementations (CloudflareKV, DynamoDB, Redis, etc.) * implement this interface. */ export interface StatusListStorageProvider { /** * Get a status list credential by ID * * @param statusListId - The status list URL * @returns The status list credential, or null if not found */ getStatusList(statusListId: string): Promise; /** * Save a status list credential * * @param statusListId - The status list URL * @param credential - The status list credential */ setStatusList(statusListId: string, credential: StatusList2021Credential): Promise; /** * Allocate a new index in a status list * * Thread-safe allocation of the next available index. * * @param statusListId - The status list URL * @returns The allocated index */ allocateIndex(statusListId: string): Promise; } /** * Identity provider for signing status list credentials */ export interface StatusListIdentityProvider { /** Get the DID of this identity */ getDid(): string; /** Get the key ID of this identity */ getKeyId(): string; } /** * StatusList2021 Manager * * Manages status lists for efficient delegation revocation. * Per Delegation-Revocation.md: * - StatusList2021 for efficient revocation distribution * - Compressed bitstrings for scalability * - Separate lists for revocation vs suspension */ export declare class StatusList2021Manager { private storage; private identity; private signingFunction; private compressor; private decompressor; private statusListBaseUrl; private defaultListSize; constructor(storage: StatusListStorageProvider, identity: StatusListIdentityProvider, signingFunction: VCSigningFunction, compressor: CompressionFunction, decompressor: DecompressionFunction, options?: { /** Base URL for status lists (e.g., "https://example.com/status") */ statusListBaseUrl?: string; /** Default size for new status lists (number of entries) */ defaultListSize?: number; }); /** * Allocate a status entry for a new delegation credential * * Per Delegation-Revocation.md: Each delegation gets a unique status list entry. * * @param purpose - "revocation" or "suspension" * @returns CredentialStatus entry for the delegation VC */ allocateStatusEntry(purpose: 'revocation' | 'suspension'): Promise; /** * Revoke or suspend a delegation by updating its status * * @param credentialStatus - The credential status entry from the VC * @param revoked - true to revoke/suspend, false to restore */ updateStatus(credentialStatus: CredentialStatus, revoked: boolean): Promise; /** * Check if a credential is revoked * * @param credentialStatus - The credential status entry * @returns true if revoked/suspended, false otherwise */ checkStatus(credentialStatus: CredentialStatus): Promise; /** * Get all revoked indices in a status list * * Useful for debugging or auditing. * * @param statusListId - The status list URL * @returns Array of revoked indices */ getRevokedIndices(statusListId: string): Promise; /** * Ensure a status list exists, creating it if needed * * @param statusListId - The status list URL * @param purpose - "revocation" or "suspension" */ private ensureStatusListExists; /** * Get the status list base URL */ getStatusListBaseUrl(): string; /** * Get the default list size */ getDefaultListSize(): number; } /** * Create a StatusList2021 manager * * Convenience factory function. * * @param storage - Storage provider * @param identity - Identity provider * @param signingFunction - VC signing function * @param compressor - Compression function * @param decompressor - Decompression function * @param options - Manager options * @returns StatusList2021Manager instance */ export declare function createStatusListManager(storage: StatusListStorageProvider, identity: StatusListIdentityProvider, signingFunction: VCSigningFunction, compressor: CompressionFunction, decompressor: DecompressionFunction, options?: { statusListBaseUrl?: string; defaultListSize?: number; }): StatusList2021Manager; //# sourceMappingURL=statuslist-manager.d.ts.map