/** * Fastify mount for the shipped routes * * The counterpart to the Express mount. Owning `wrapRouteHandler` internally is what * removes the casts consumers previously needed when wiring routes by hand. * * @packageDocumentation */ import { NAuthConfig } from '../../interfaces/config.interface'; import { NAuthRouteServices } from '../route-services'; import { NAuthRouteMountOptions } from '../resolve-mount'; /** * Anything that can register Fastify routes — an instance, or a plugin scope. * * Deliberately `unknown`: see {@link FastifyRouteRegistrar}. */ export type FastifyInstanceLike = unknown; /** The parts of an NAuth instance this mount needs. */ export interface FastifyMountInstance 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 a Fastify instance. * * Register inside an encapsulated scope to apply a prefix: * * @param fastify - The Fastify instance or plugin scope * @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 * await fastify.register( * async (scope) => registerNAuthFastifyRoutes(scope, nauth, { delivery: 'cookies' }), * { prefix: '/auth' }, * ); * ``` */ export declare function registerNAuthFastifyRoutes(fastify: FastifyInstanceLike, instance: FastifyMountInstance, options?: NAuthRouteMountOptions): void; //# sourceMappingURL=fastify.d.ts.map