This commit is contained in:
2026-07-31 23:21:51 +02:00
parent f6b4b36df8
commit f14f2cfd98
294 changed files with 5880 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
export type RateLimitArgs = {
/** Identifier to limit on — typically the client IP. */
key: string;
/** Max submissions allowed per window. Defaults to 5. */
max?: number;
/** Window length in ms. Defaults to 60_000 (one minute). */
windowMs?: number;
};
/**
* Returns true when the request is within the limit, false when it should be
* rejected. A missing key (no IP) is allowed through — better to accept a
* submission than to block everyone behind a proxy that strips the header.
*/
export declare function checkRateLimit({ key, max, windowMs }: RateLimitArgs): boolean;