/** * Honeypot + time-trap validators for form submissions. * * - Honeypot: a hidden field that legitimate users leave empty. Bots * typically auto-fill every input. * - Time-trap: rejects submissions that arrive too fast (bots) or * impossibly late (stale tokens / replay attempts). * * Neither mechanism is a full bot-defense on its own — combine with * Cloudflare Turnstile + rate limiting for layered protection. * * Pure functions, no I/O. Adapted from the proven @adamarant/cms implementation. */ export interface HoneypotPayload { /** Value of the hidden honeypot field (must be empty/undefined for humans). */ honeypotValue?: string | null; /** Client-side timestamp (ms) captured when the form was rendered. */ renderedAt?: number | string | null; } export interface HoneypotValidatorOptions { /** * Minimum time (ms) a human needs to fill the form. Submissions faster * than this are rejected. Defaults to 2000ms. */ minFillMs?: number; /** * Maximum age (ms) of the rendered-at timestamp. Submissions older than * this are rejected (stale form). Defaults to 30 minutes. */ maxAgeMs?: number; /** Clock override for tests. */ now?: () => number; } export type HoneypotFailureReason = 'honeypot-filled' | 'too-fast' | 'stale' | 'missing-timestamp' | 'invalid-timestamp'; export type HoneypotResult = { ok: true; } | { ok: false; reason: HoneypotFailureReason; }; /** Validate a honeypot + time-trap payload. */ export declare function validateHoneypot(payload: HoneypotPayload, options?: HoneypotValidatorOptions): HoneypotResult; //# sourceMappingURL=honeypot.d.ts.map