@yveskaufmann/koa2-ratelimit
Version:
IP rate-limiting middleware for Koajs 2. Use to limit repeated requests to APIs and/or endpoints such as password reset.
17 lines • 591 B
TypeScript
import { RateLimitOptions } from "../Options";
export interface SaveAbuseOptions extends RateLimitOptions {
key: string;
ip: string;
user_id: string;
}
export declare abstract class Store {
constructor();
abstract incr(key: string, options: RateLimitOptions, weight: number): Promise<HitState>;
abstract decrement(key: string, options: RateLimitOptions, weight: number): Promise<void>;
abstract saveAbuse(abuse?: SaveAbuseOptions): Promise<void> | void;
}
export interface HitState {
counter: number;
dateEnd: number;
}
//# sourceMappingURL=Store.d.ts.map