import { JsonApiService } from "../../../core/jsonapi/services/jsonapi.service"; import { BackupCodeRepository } from "../repositories/backup-code.repository"; export interface BackupCodeGenerationResult { codes: string[]; count: number; } /** * Backup Code Service * * Manages single-use backup codes for two-factor authentication recovery. * Codes are 8 hex characters, bcrypt hashed, and can only be used once. */ export declare class BackupCodeService { private readonly jsonApiService; private readonly backupCodeRepository; constructor(jsonApiService: JsonApiService, backupCodeRepository: BackupCodeRepository); /** * Generate a batch of backup codes for a user. * Codes are returned in plain text ONCE - they should be shown to the user * and will never be retrievable again (only hashes are stored). * * @param params.userId - The user's ID * @returns JSON:API response with plain text backup codes (show to user once) */ generateCodes(params: { userId: string; }): Promise; /** * Validate a backup code for a user. * If valid, the code is marked as used and cannot be reused. * * @param params.userId - The user's ID * @param params.code - The backup code to validate (8 hex characters) * @returns true if the code was valid and has been consumed */ validateCode(params: { userId: string; code: string; }): Promise; /** * Get the count of unused backup codes for a user. * * @param params.userId - The user's ID * @returns JSON:API response with unused backup codes count */ getUnusedCount(params: { userId: string; }): Promise; /** * Get the raw count of unused backup codes (for internal use). * * @param params.userId - The user's ID * @returns Number of unused backup codes */ getRawUnusedCount(params: { userId: string; }): Promise; /** * Regenerate backup codes for a user. * This deletes all existing codes (used and unused) and generates a new batch. * * @param params.userId - The user's ID * @returns JSON:API response with new plain text backup codes (show to user once) */ regenerateCodes(params: { userId: string; }): Promise; /** * Check if a user has any backup codes (used or unused). * * @param params.userId - The user's ID * @returns true if the user has any backup codes */ hasBackupCodes(params: { userId: string; }): Promise; /** * Delete all backup codes for a user. * * @param params.userId - The user's ID */ deleteAllCodes(params: { userId: string; }): Promise; /** * Generate a single random backup code. * Format: 8 uppercase hex characters (e.g., "A1B2C3D4") */ private generateSingleCode; /** * Create backup codes in the database and return plain text codes. */ private createBackupCodes; } //# sourceMappingURL=backup-code.service.d.ts.map