/** * Storage adapter interface for shared state management * Critical for multi-server deployments */ export interface StorageAdapter { /** * Initialize the storage adapter */ initialize(): Promise; /** * Check if adapter is healthy */ isHealthy(): Promise; /** * Basic key-value operations */ get(key: string): Promise; set(key: string, value: string, ttlSeconds?: number, options?: { nx?: boolean; }): Promise; del(key: string): Promise; exists(key: string): Promise; /** * Atomic operations */ incr(key: string, ttlSeconds?: number): Promise; decr(key: string): Promise; expire(key: string, ttl: number): Promise; ttl(key: string): Promise; /** * Hash operations (for complex data structures) */ hget(key: string, field: string): Promise; hset(key: string, field: string, value: string): Promise; hgetall(key: string): Promise>; hdel(key: string, ...fields: string[]): Promise; /** * List operations (for token families) */ lpush(key: string, value: string): Promise; lrange(key: string, start: number, stop: number): Promise; llen(key: string): Promise; /** * Pattern operations */ keys(pattern: string): Promise; scan(cursor: number, pattern: string, count: number): Promise<[number, string[]]>; /** * Cleanup and disconnect */ cleanup(): Promise; disconnect(): Promise; } /** * Rate limiting specific operations */ export interface RateLimitStorage { incrementRateLimit(identifier: string, endpoint: string, windowMs: number): Promise; getRateLimit(identifier: string, endpoint: string): Promise; resetRateLimit(identifier: string, endpoint: string): Promise; } /** * Account lockout specific operations * * SECURITY: Uses IP addresses instead of user identifiers to prevent * attackers from locking out legitimate users by guessing their email/username. */ export interface AccountLockoutStorage { /** * Record a failed login attempt for an IP address. * * SECURITY NOTE: * Use an expiry window to prevent counters from accumulating indefinitely, which can cause * unexpected lockouts long after the original failures. * * @param ipAddress - IP address that made the failed attempt * @param ttlSeconds - Optional TTL (seconds) applied when the counter key is first created * @returns Number of failed attempts for this IP within the active window */ recordFailedAttempt(ipAddress: string, ttlSeconds?: number): Promise; getFailedAttempts(ipAddress: string): Promise; isAccountLocked(ipAddress: string): Promise; lockIpAddress(ipAddress: string, duration: number, reason: string): Promise; unlockIpAddress(ipAddress: string): Promise; resetFailedAttempts(ipAddress: string): Promise; } //# sourceMappingURL=storage-adapter.interface.d.ts.map