import { FastifyInstance, FastifyPluginOptions, FastifyReply, FastifyRequest } from 'fastify';
import { ReAuthEngine, Entity, AuthToken } from '@re-auth/reauth';
export interface FastifyAuthConfig extends FastifyPluginOptions {
    prefix?: string;
    cookieName?: string;
    cookieOptions?: {
        httpOnly?: boolean;
        secure?: boolean;
        sameSite?: 'strict' | 'lax' | 'none' | boolean;
        maxAge?: number;
        domain?: string;
        path?: string;
    };
}
export declare class FastifyAuthAdapter {
    private fastify;
    private engine;
    private config;
    constructor(fastify: FastifyInstance, engine: ReAuthEngine, config?: FastifyAuthConfig);
    private setup;
    private authHook;
    private registerRoutes;
    private createStepHandler;
    private extractInputs;
    private handleStepResponse;
    private getStatusCode;
    private errorResponse;
    private authenticate;
    private extractToken;
    protect(options: ProtectOptions): (request: FastifyRequest, reply: FastifyReply, done: () => void) => Promise<undefined>;
}
interface ProtectOptions {
    roles?: string[];
    authorize?: (user: Entity, request: FastifyRequest, reply: FastifyReply, done: () => void) => Promise<boolean>;
}
export declare function createFastifyAdapter(fastify: FastifyInstance, engine: ReAuthEngine, config?: FastifyAuthConfig): Promise<FastifyAuthAdapter>;
declare module 'fastify' {
    interface FastifyRequest {
        user?: Entity;
        token?: AuthToken;
        isAuthenticated: boolean;
    }
    interface FastifyInstance {
        authenticate: (request: FastifyRequest, reply: FastifyReply, done: () => void) => void;
    }
}
export default createFastifyAdapter;
export * from './fastify-adapter-v2';
//# sourceMappingURL=index.d.ts.map