/** * Enhanced CSRF Protection Plugin * * Provides comprehensive Cross-Site Request Forgery protection */ import type { Context } from '../context.js'; export interface CSRFOptions { secret?: string; cookieName?: string; headerName?: string; tokenName?: string; enforceForMethods?: string[]; cookieOptions?: { httpOnly?: boolean; secure?: boolean; sameSite?: 'strict' | 'lax' | 'none'; maxAge?: number; }; ignorePaths?: string[]; validateOrigin?: boolean; trustedOrigins?: string[]; } export declare class CSRFProtection { private options; constructor(options?: CSRFOptions); /** * Generate CSRF secret */ private generateSecret; /** * Generate CSRF token */ generateToken(): string; /** * Verify CSRF token */ verifyToken(token: string): boolean; /** * Constant-time string comparison */ private constantTimeCompare; /** * Validate origin header */ private validateOrigin; /** * CSRF middleware */ middleware(): (ctx: Context, next: () => Promise) => Promise; /** * Get client IP */ private getClientIP; } /** * Create CSRF protection middleware */ export declare function csrf(options?: CSRFOptions): (ctx: Context, next: () => Promise) => Promise; /** * CSRF token helper for templates */ export declare function csrfToken(ctx: Context): string; /** * CSRF hidden input helper for forms */ export declare function csrfInput(ctx: Context, name?: string): string; //# sourceMappingURL=csrfProtection.d.ts.map