/// <reference types="node" />
import { AuthenticationState } from "../data";
import { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
import { FastifyAuthFunction } from "@fastify/auth";
import { preHandlerHookHandler } from "fastify/types/hooks";
import "@fastify/cookie";
import "fastify-raw-body";
export declare const NOT_AUTHORIZED_ERROR_MESSAGE = "not authorized";
export declare const NOT_ANONYMOUS_ERROR_MESSAGE = "not anonymous";
export declare function bearerAuthentication(key: string, request: FastifyRequest): Promise<boolean>;
export declare const allowUnauthenticated: FastifyAuthFunction;
export declare const accessToken: FastifyAuthFunction;
export declare function getFastifyVerifyBearerAuth(fastify: FastifyInstance): FastifyAuthFunction;
export interface FastifyAuthOptions {
    relation?: "and" | "or";
    run?: "all";
}
export declare function getFastifyAuth(fastify: FastifyInstance): (functions: FastifyAuthFunction[] | (FastifyAuthFunction | FastifyAuthFunction[])[], options?: {
    relation?: "and" | "or";
    run?: "all";
}) => preHandlerHookHandler<import("fastify").RawServerDefault, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").RouteGenericInterface, unknown, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, import("fastify").FastifyBaseLogger>;
export interface AuthInput extends FastifyAuthOptions {
    internal?: boolean;
    unauthenticated?: boolean;
    /**
     * @deprecated use unauthenticated: true
     */
    anonymous?: boolean;
}
export declare function isHTMLResponse(request: FastifyRequest): boolean;
export declare function authenticateSignature(fastify: FastifyInstance, options?: AuthInput): preHandlerHookHandler<import("fastify").RawServerDefault, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").RouteGenericInterface, unknown, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, import("fastify").FastifyBaseLogger>;
export declare function authenticate(fastify: FastifyInstance, options?: AuthInput): preHandlerHookHandler;
export declare function setAuthenticationStateCookie(response: FastifyReply, { stateId, expiresAt }: AuthenticationState): void;
