/**
 * Hono session boundary — cookie I/O, request-time middleware, and the
 * session-creation helper shared by login / signup / bootstrap.
 *
 * @module
 */
import type { Context, MiddlewareHandler } from 'hono';
import type { Keyring } from './keyring.js';
import { type SessionOptions } from './session_cookie.js';
import type { QueryDeps } from '../db/query_deps.js';
/**
 * Read the session cookie value from a request.
 */
export declare const get_session_cookie: <T>(c: Context, options: SessionOptions<T>) => string | undefined;
/**
 * Set the session cookie on a response.
 *
 * `options.max_age` is the single source of truth for cookie lifetime: it
 * drives both the embedded `expires_at` (via `create_session_cookie_value`)
 * and the cookie's HTTP `Max-Age` attribute set here. Falls back to
 * `session_cookie_options.maxAge` (= `SESSION_AGE_MAX`) when unset.
 * `options.cookie_options` cannot carry `maxAge` (omitted in the type) so
 * the two values can't drift.
 */
export declare const set_session_cookie: <T>(c: Context, value: string, options: SessionOptions<T>) => void;
/**
 * Clear the session cookie on a response.
 */
export declare const clear_session_cookie: <T>(c: Context, options: SessionOptions<T>) => void;
/**
 * Create session middleware that parses cookies and sets identity on context.
 *
 * Always sets the identity on context (null when invalid/missing) for type-safe reads.
 * Uses `options.context_key` as the Hono context variable name.
 *
 * @param keyring - key ring for cookie verification
 * @param options - session configuration
 * @mutates Hono context - sets `options.context_key` and may refresh or clear the session cookie
 */
export declare const create_session_middleware: <TIdentity>(keyring: Keyring, options: SessionOptions<TIdentity>) => MiddlewareHandler;
/**
 * Options for `create_session_and_set_cookie`.
 */
export interface CreateSessionAndSetCookieOptions {
    /** Keyring for cookie signing. */
    keyring: Keyring;
    /** Query deps (needs db for session creation). */
    deps: QueryDeps;
    /** Hono context for setting the cookie. */
    c: Context;
    /** The account to create a session for. */
    account_id: string;
    /** Session cookie configuration. */
    session_options: SessionOptions<string>;
    /** Per-account session cap (`null` to skip enforcement). */
    max_sessions?: number | null;
}
/**
 * Create an auth session and set the session cookie on the response.
 *
 * Shared by login, signup, and bootstrap — generates a token, hashes it,
 * persists the session row, optionally enforces a per-account session limit,
 * and sets the signed cookie.
 *
 * @mutates `auth_session` table - inserts the new session row (and evicts older rows when `max_sessions` is set)
 */
export declare const create_session_and_set_cookie: (options: CreateSessionAndSetCookieOptions) => Promise<void>;
//# sourceMappingURL=session_middleware.d.ts.map