/** * Rate Limiter Middleware * Provides request rate limiting using Redis */ import { Request, Response, NextFunction } from 'express'; import { RedisCache } from '../cache/redis-cache'; export interface RateLimitOptions { maxRequests: number; windowMs: number; message: string; statusCode: number; keyGenerator: (req: Request) => string; } /** * Create rate limiter middleware * * @param cache - Redis cache instance * @param options - Rate limit options * @returns Express middleware */ export declare function rateLimiter(cache: RedisCache, options?: Partial): (req: Request, res: Response, next: NextFunction) => Promise> | undefined>; /** * Create API-specific rate limiter * Different limits for different endpoints */ export declare function apiRateLimiter(cache: RedisCache, limits: { default: { maxRequests: number; windowMs: number; }; strict?: { maxRequests: number; windowMs: number; }; relaxed?: { maxRequests: number; windowMs: number; }; }): (tier?: "default" | "strict" | "relaxed") => (req: Request, res: Response, next: NextFunction) => Promise> | undefined>; /** * Create user-based rate limiter * Uses user ID instead of IP */ export declare function userRateLimiter(cache: RedisCache, maxRequests?: number, windowMs?: number): (req: Request, res: Response, next: NextFunction) => Promise> | undefined>; declare const _default: { rateLimiter: typeof rateLimiter; apiRateLimiter: typeof apiRateLimiter; userRateLimiter: typeof userRateLimiter; }; export default _default;