import type { H3Event } from 'h3'; import type { EponymeAuthUser, EponymeRole } from '../../types/index.js'; export declare const EPONYME_SESSION_COOKIE = "eponyme_session"; /** * `__Host-` binds the cookie to this exact origin and to a secure connection, so a subdomain - or a page * served over plain HTTP - cannot write a session cookie the dashboard would then read. The prefix is only * legal on a secure cookie, so development keeps the plain name. */ export declare const EPONYME_SESSION_COOKIE_SECURE = "__Host-eponyme_session"; export declare function eponymeSessionCookieName(): string; /** Reads whichever of the two names the browser holds, so an open session survives a deployment. */ export declare function readEponymeSessionCookie(event: H3Event): string | undefined; export declare function getEponymeEventUser(event: H3Event): Promise; export declare function requireEponymeUser(event: H3Event, options?: { roles?: EponymeRole[]; allowPasswordChangeRequired?: boolean; }): Promise; export declare function setEponymeSessionCookie(event: H3Event, token: string, expiresAt: Date): void; export declare function clearEponymeSessionCookie(event: H3Event): void; /** * A browser sends `Origin` on every mutation, so an absent one is either a client that is not a browser or * a request built to skip the check. It stays allowed while no session rides on it - a public form post, a * machine calling the API with no cookie - and is refused as soon as the request carries the session * cookie, since that is the only case a forged one could use. */ export declare function assertEponymeMutationOrigin(event: H3Event): void;