import type { FastifyRequest, FastifyReply } from 'fastify'; import type { AuthStrategy } from '../auth/AuthStrategy.js'; import type { LoginMeta, LoginEntryMeta } from '@pylonts/core'; export type AuthHook = (request: FastifyRequest, reply: FastifyReply) => Promise; export interface AuthHookMeta { /** @Public preserves its original semantics — marked routes skip the token auth hook (no signature check). */ isPublic: boolean; loginMeta?: LoginMeta; loginEntryMeta?: LoginEntryMeta; } export interface AuthHookFactoryOptions { tokenStrategy?: AuthStrategy; } export interface AuthHookFactory { /** Returns true if this factory should handle the given auth metadata */ accept(meta: AuthHookMeta): boolean; /** Creates preValidation hooks for the route */ create(meta: AuthHookMeta, options: AuthHookFactoryOptions): AuthHook[]; } /** Computes auth label string for logging */ export declare function authLabel(meta: AuthHookMeta): string; /** * Unified token auth hook — every route is signed unless marked @Public. * @Public(meta.isPublic) skips the hook entirely (no signature check). * @Login(module) scopes the app (module = app name, Redis key prefix); * @LoginEntry(app) marks a token-less login entry (bootstrap / refresh verify). */ export declare class TokenAuthHookFactory implements AuthHookFactory { accept(): boolean; create(meta: AuthHookMeta, options: AuthHookFactoryOptions): AuthHook[]; } /** Registry that holds AuthHookFactory instances and delegates via first-match */ export declare class AuthHookFactoryRegistry { private factories; register(factory: AuthHookFactory): void; create(meta: AuthHookMeta, options: AuthHookFactoryOptions): AuthHook[]; } //# sourceMappingURL=auth-factory.d.ts.map