/** * MemberIdentityProofService — companion service for managing identity proofs * associated with BrightChain members. * * Since {@link Member} is an external class from `@digitaldefiance/ecies-lib`, * this service follows the same companion-service pattern as * {@link MemberPaperKeyService}: it maintains an in-memory store of identity * proofs keyed by member ID, with full audit logging. * * Requirements: 4.5, 4.7 */ import { VerificationStatus } from '../../enumerations/verificationStatus'; import { IIdentityProof } from '../../interfaces/identity/identityProof'; /** * Error thrown when a proof operation references a proof that does not exist. */ export declare class ProofNotFoundError extends Error { constructor(proofId: string); } /** * Error thrown when attempting to revoke an already-revoked proof. */ export declare class ProofAlreadyRevokedError extends Error { constructor(proofId: string); } /** * Actions that can be recorded in the identity proof audit log. */ export type ProofAuditAction = 'added' | 'revoked' | 'verified' | 'failed'; /** * A single entry in the identity proof audit log. * * @remarks * The audit log is append-only and provides a complete history of * proof lifecycle events for a member. */ export interface IProofAuditEntry { /** Unique identifier for this audit entry */ id: TId; /** The proof this entry relates to */ proofId: TId; /** The action that was performed */ action: ProofAuditAction; /** When the action occurred */ timestamp: Date; /** Optional reason or context for the action */ reason?: string; } /** * Companion service for managing identity proofs associated with members. * * Maintains an in-memory store of identity proofs keyed by member ID, * with full audit logging. Provides methods to add, revoke, and query * proofs without modifying the external Member class. * * @example * ```typescript * const service = new MemberIdentityProofService(); * * // Add a proof * service.addProof(memberId, proof); * * // Get all verified proofs * const verified = service.getVerifiedProofs(memberId); * * // Revoke a proof * service.revokeProof(memberId, proofId, 'Account compromised'); * ``` */ export declare class MemberIdentityProofService { /** * Identity proofs keyed by member ID. */ private readonly proofsByMember; /** * Append-only audit log keyed by member ID. */ private readonly auditLogByMember; /** * Factory for generating unique IDs. */ private readonly idFactory; constructor(idFactory?: () => TId); /** * Add an identity proof for a member. * * Stores the proof and appends an 'added' entry to the audit log. * * **Validates: Requirement 4.5** * * @param memberId - The member this proof belongs to * @param proof - The identity proof to add */ addProof(memberId: TId, proof: IIdentityProof): void; /** * Revoke an identity proof. * * Sets the proof's verification status to REVOKED and records * a revokedAt timestamp. Appends a 'revoked' entry to the audit log. * * **Validates: Requirement 4.7** * * @param memberId - The member who owns the proof * @param proofId - The proof to revoke * @param reason - Optional reason for revocation * @throws {ProofNotFoundError} If the proof does not exist * @throws {ProofAlreadyRevokedError} If the proof is already revoked */ revokeProof(memberId: TId, proofId: TId, reason?: string): void; /** * Update the verification status of a proof. * * Used after checking a proof URL to record whether verification * succeeded or failed. * * @param memberId - The member who owns the proof * @param proofId - The proof to update * @param verified - Whether verification succeeded */ updateVerificationStatus(memberId: TId, proofId: TId, verified: boolean): void; /** * Get all identity proofs for a member. * * @param memberId - The member to query * @returns Read-only array of identity proofs (empty if none exist) */ getProofs(memberId: TId): ReadonlyArray>; /** * Get only verified identity proofs for a member. * * **Validates: Requirement 4.5** * * @param memberId - The member to query * @returns Read-only array of verified identity proofs */ getVerifiedProofs(memberId: TId): ReadonlyArray>; /** * Get a specific proof by ID. * * @param memberId - The member who owns the proof * @param proofId - The proof to retrieve * @returns The identity proof * @throws {ProofNotFoundError} If the proof does not exist */ getProof(memberId: TId, proofId: TId): IIdentityProof; /** * Get the audit log for a member's identity proofs. * * @param memberId - The member to query * @returns Read-only array of audit entries (empty if none exist) */ getAuditLog(memberId: TId): ReadonlyArray>; /** * Check whether a proof is revoked. * * @param memberId - The member who owns the proof * @param proofId - The proof to check * @returns `true` if the proof is revoked * @throws {ProofNotFoundError} If the proof does not exist */ isRevoked(memberId: TId, proofId: TId): boolean; /** * Get the count of proofs for a member, optionally filtered by status. * * @param memberId - The member to query * @param status - Optional status filter * @returns The number of matching proofs */ getProofCount(memberId: TId, status?: VerificationStatus): number; /** * Remove all data for a member. Useful for testing. * * @param memberId - The member whose data to clear */ clearMemberData(memberId: TId): void; private findProof; private appendAuditEntry; } //# sourceMappingURL=memberIdentityProofService.d.ts.map