/** * Authentication Middleware * * Provides JWT and API key authentication for HTTP endpoints */ import { Request, Response, NextFunction } from "express"; import { JwtPayload } from "../auth/jwt.js"; declare global { namespace Express { interface Request { user?: JwtPayload; authMethod?: "jwt" | "api_key"; } } } export interface AuthMiddlewareOptions { apiKey?: string; jwtPublicKey: string; requireAuth?: boolean; } /** * Create authentication middleware that supports both JWT and API key */ export declare function createAuthMiddleware(options: AuthMiddlewareOptions): (req: Request, res: Response, next: NextFunction) => void; /** * Middleware to require JWT authentication (no API key fallback) */ export declare function requireJWT(jwtPublicKey: string): (req: Request, res: Response, next: NextFunction) => void; /** * Optional authentication middleware (allows unauthenticated requests) */ export declare function optionalAuth(options: AuthMiddlewareOptions): (req: Request, res: Response, next: NextFunction) => void;