import type { PoppyConnectionsTexts } from './config.js';
import type { PoppyConnections } from './service.js';
/** The slice of a request/response the routes need — Adonis or a bare `node:http` server. */
export interface PoppyConnectionsExchange {
    method: string;
    /** Path without the query string. */
    path: string;
    query: URLSearchParams;
    readBody(limit: number): Promise<string>;
    send(status: number, headers: Record<string, string>, body: string): void;
}
/** What a connect page shows, for an app that renders its own (`render`). */
export type PoppyConnectView = {
    view: 'expired';
} | {
    view: 'connected';
    organization: string;
} | {
    view: 'failed';
    organization: string | null;
    retryUrl: string | null;
} | {
    view: 'choose';
    organization: string;
    directUrl: string | null;
    deviceUrl: string | null;
    mediated: {
        action: string;
        fields: {
            name: string;
            label: string;
            secret: boolean;
        }[];
    } | null;
} | {
    view: 'code';
    organization: string;
    action: string;
    sentTo: string;
} | {
    view: 'device';
    organization: string;
    userCode: string;
    verificationUri: string;
    checkUrl: string;
    pending: boolean;
};
export type PoppyConnectRenderer = (view: PoppyConnectView, texts: PoppyConnectionsTexts) => string;
/** The built-in pages: plain, accessible HTML; an app gives its own look with `render`. */
export declare const defaultConnectRenderer: PoppyConnectRenderer;
/** The default identity logo: the name's initial on a rounded square. */
export declare function defaultLogoSvg(name: string): string;
/**
 * The routes under `/{path}`: the agent identity (`agent.json`, `jwks.json`), the connect pages and
 * the Direct Sign-In callback. Returns `false` for anything else. Mounted ahead of the router: no
 * session, no CSRF token — the connect id in the URL is the capability (128 bits, single-purpose,
 * expiring), and the forms only ever post back to the same id.
 */
export declare function createPoppyConnectionsHandler(connections: PoppyConnections, options?: {
    render?: PoppyConnectRenderer;
    onError?: (error: unknown) => void;
}): (ex: PoppyConnectionsExchange) => Promise<boolean>;
//# sourceMappingURL=http.d.ts.map