/** * Express mount for the shipped routes * * Registers the resolved manifest on a router you own. Structurally typed so core keeps * its zero framework imports — the Express adapter takes the same approach. * * @packageDocumentation */ import { NAuthConfig } from '../../interfaces/config.interface'; import { NAuthRouteServices } from '../route-services'; import { NAuthRouteMountOptions } from '../resolve-mount'; /** The slice of an Express router the mount registers on. */ export interface ExpressRouterLike { get(path: string, ...handlers: unknown[]): unknown; post(path: string, ...handlers: unknown[]): unknown; put(path: string, ...handlers: unknown[]): unknown; patch(path: string, ...handlers: unknown[]): unknown; delete(path: string, ...handlers: unknown[]): unknown; } /** The parts of an NAuth instance this mount needs. */ export interface ExpressMountInstance extends NAuthRouteServices { config: NAuthConfig; helpers: { public(): unknown; requireAuth(options?: { csrf?: boolean; }): unknown; tokenDelivery(mode: 'json' | 'cookies'): unknown; requireRecaptcha?(): unknown; skipRecaptcha?(): unknown; allowApiKey?(): unknown; denyApiKey?(): unknown; }; authorizationService?: { isConfigured(): boolean; }; } /** * Register the shipped auth routes on an Express router. * * The router is mounted by the caller, so `prefix` is only used for error messages and * for validating the bundle — mount the returned router where you want the paths. * * @param router - An Express `Router()` or the application itself * @param instance - The instance returned by `NAuth.create()` * @param options - Which routes to mount, and how * @throws {Error} When the bundle is misconfigured — see `resolveMount` * * @example * ```typescript * app.use('/auth', registerNAuthExpressRoutes(express.Router(), nauth, { delivery: 'cookies' })); * ``` */ export declare function registerNAuthExpressRoutes(router: ExpressRouterLike, instance: ExpressMountInstance, options?: NAuthRouteMountOptions): void; //# sourceMappingURL=express.d.ts.map