import { type UseQueryResult } from '@tanstack/react-query';
import { RequestError } from '@darajs/ui-utils';
import { type User, type UserData } from '../types';
declare enum AuthenticationErrorReason {
    BAD_REQUEST = "bad_request",
    EXPIRED_TOKEN = "expired",
    INVALID_CREDENTIALS = "invalid_credentials",
    INVALID_TOKEN = "invalid_token",
    OTHER = "other",
    UNAUTHORIZED = "unauthorized"
}
interface RedirectResponse {
    redirect_uri: string;
}
interface SuccessResponse {
    success: boolean;
}
/**
 * Revoke the current session
 */
export declare function revokeSession(): Promise<RedirectResponse | SuccessResponse | null>;
/**
 * Resolve the referrer url to be passed back to login, adjusted for the base path.
 */
export declare function resolveReferrer(): string;
/**
 * Helper function to handle auth errors in a response
 *
 * @param res the response object to check
 * @param toLogin if true, open the login page, else open the error page
 * @param ignoreErrors if specified, certain reasons for an error will be ignored
 */
export declare function handleAuthErrors(res: Response, toLogin?: boolean, ignoreErrors?: Array<AuthenticationErrorReason> | null): Promise<boolean>;
/**
 * Api call to get user data from the backend
 */
export declare function useUser(): UseQueryResult<UserData, RequestError>;
/** Api call to create a session with the backend */
export declare function requestSessionToken(body?: User): Promise<boolean>;
/** Api call to create a session with the backend */
export declare function useSession(body?: User): UseQueryResult<boolean, RequestError>;
/** Api call to verify the session token from the backend */
export declare function verifySessionToken(): Promise<boolean>;
export {};
//# sourceMappingURL=auth.d.ts.map