first commit

This commit is contained in:
2026-07-12 15:55:18 +05:30
commit ee98026cc5
404 changed files with 44522 additions and 0 deletions
@@ -0,0 +1,16 @@
import { rateLimit, type Context, type Next } from "@wrnexus/core";
// Scoped rate limiting: throttle POST /api/login to blunt brute-force attempts.
// The limiter keeps per-IP counters; other routes pass straight through.
const loginLimiter = rateLimit({
max: 5,
windowMs: 60_000,
message: "Too many login attempts. Please wait a minute and try again.",
});
export default async function ratelimit(ctx: Context, next: Next) {
if (ctx.url.pathname === "/api/login" && ctx.req.method === "POST") {
return loginLimiter(ctx, next);
}
return next();
}