22 lines
575 B
TypeScript
22 lines
575 B
TypeScript
import {
|
|
createCaptchaEngine,
|
|
createCaptchaHttpHandlers,
|
|
MemoryCaptchaStore,
|
|
} from "@wrnexus/captcha/server";
|
|
|
|
export const captchaEngine = createCaptchaEngine({
|
|
secret: process.env.CAPTCHA_SECRET ?? "development-auth-showcase-captcha-secret-change-this",
|
|
store: new MemoryCaptchaStore(),
|
|
basePath: "/api/captcha",
|
|
challengeTtlMs: 2 * 60_000,
|
|
responseTokenTtlMs: 5 * 60_000,
|
|
maxAttempts: 3,
|
|
minCompletionMs: 800,
|
|
});
|
|
|
|
export const captchaHandlers = createCaptchaHttpHandlers(captchaEngine, {
|
|
createLimit: 60,
|
|
verifyLimit: 60,
|
|
windowMs: 60_000,
|
|
});
|