import { NextRequest, NextResponse } from 'next/server'; type AuthenticatedRequest = NextRequest & { userId: string; userEmail: string; }; type OptionalAuthRequest = NextRequest & { userId?: string; userEmail?: string; }; type AuthenticatedHandler = (req: AuthenticatedRequest, ...args: any[]) => Promise; type OptionalAuthHandler = (req: OptionalAuthRequest, ...args: any[]) => Promise; /** * Wraps a Next.js API route handler with required authentication. * Extracts JWT from cookies or Authorization header, sets request context for RLS. * Returns 401 if no valid token is present. */ export declare function authMiddleware(handler: AuthenticatedHandler): any; /** * Optional auth — sets context if token present, continues without if not. * * IMPORTANT: When userId is null (unauthenticated), the RLS plugin will block * all owned-data queries by default. Check req.userId before querying user-specific data. */ export declare function optionalAuth(handler: OptionalAuthHandler): any; export {}; //# sourceMappingURL=middleware.d.ts.map