import type { Request, Response, RequestHandler } from 'express'; import type { IRateLimiterOptions } from 'rate-limiter-flexible'; import { RateLimiterCluster, RateLimiterMemory, RateLimiterRes } from 'rate-limiter-flexible'; export declare const createRateLimiter: (keyScope: string, opts: IRateLimiterOptions) => RateLimiterMemory | RateLimiterCluster | { consume: (key: string | number, pointsToConsume?: number | undefined, options?: { [key: string]: any; } | undefined) => Promise; penalty: (key: string | number, points?: number | undefined, options?: { [key: string]: any; } | undefined) => Promise; delete: (key: string | number, options?: { [key: string]: any; } | undefined) => Promise; }; export declare const getUserIDFromCreds: (req: Request) => string; export type RateLimitKeyFn = (req: Request, res: Response) => Resolvable; export type RateLimitKey = string | RateLimitKeyFn; export type RateLimitMiddleware = (...args: Parameters) => Promise; export type PartialRateLimitMiddleware = (field?: RateLimitKey) => RateLimitMiddleware; export declare const createRateLimitMiddleware: (rateLimiter: ReturnType, keyOpts?: Parameters[1]) => PartialRateLimitMiddleware; /** * If 'field' is set, the middleware will apply the rate limit to requests * that originate from the same IP *and* have the same 'field'. * * If 'field' is not set, the rate limit will be applied to *all* requests * originating from a particular IP. */ declare const $createRateLimitMiddleware: (rateLimiter: ReturnType, { ignoreIP, allowReset, }?: { ignoreIP?: boolean; allowReset?: boolean; }, field?: RateLimitKey) => RateLimitMiddleware; export {};