UNPKG

xmcp

Version:

The TypeScript MCP framework

26 lines (25 loc) • 768 B
import { RequestHandler } from "express"; import { VerifyOptions } from "jsonwebtoken"; export interface JWTAuthMiddlewareConfig extends VerifyOptions { secret: string; } /** * Middleware to authenticate requests using a JWT. * @param config - Configuration object containing the JWT secret and verify options. * @returns Express middleware function. * * @example * ```ts * const middleware = jwtAuthMiddleware({ * secret: process.env.JWT_SECRET!, * algorithms: ["HS256"], * issuer: "https://example.com", * audience: "https://example.com", * subject: "user-id", * expiresIn: "1h", * notBefore: "1h", * clockTolerance: 30, * }); * ``` */ export declare function jwtAuthMiddleware(config: JWTAuthMiddlewareConfig): RequestHandler;