import type { Context, Next } from "@wrnexus/core"; import { captchaPageGate } from "@wrnexus/captcha/server"; import { captchaEngine } from "../lib/captcha.ts"; const pageGate = captchaPageGate({ action: "protected-page-access", engine: captchaEngine, challengePath: "/captcha", policy: { mode: "session", verifiedForMs: 15 * 60_000, routeGroups: ["/protected"], }, }); export default function captchaProtectedPages(ctx: Context, next: Next) { if (ctx.url.pathname === "/protected" || ctx.url.pathname === "/api/page-grant") { return pageGate(ctx, next); } return next(); }