import { StoredKeys, Endpoint } from '@byollm/protocol'; import { B as ByollmStore } from './store-BkDHRir0.js'; /** Everything a mount needs to serve the protocol. */ /** * What a transport must hand the handler to authenticate a call. * * `rawBody` is the exact bytes received, not a re-serialisation of the parsed * object: JSON.stringify does not round-trip byte-for-byte, and a signature * over re-serialised input verifies something the sender never signed. */ interface AuthContext { readonly endpoint: string; readonly rawBody: string; readonly signature: unknown; } interface HandlerConfig { readonly store: ByollmStore; /** * Absolute URL of the page where a user approves a pairing. The device code * is *not* appended โ€” the user types the short code into the app's own * authenticated page, which is what keeps pairing interactive. */ readonly verificationUrl: string; /** How long a lease lasts. Default 60s โ€” six heartbeats of headroom. */ readonly leaseMs?: number; /** How long an unapproved pairing code lives. Default 10 minutes. */ readonly pairingTtlMs?: number; /** How often a daemon may poll for pairing approval. Default 2s. */ readonly pollIntervalMs?: number; /** Injectable clock, so tests can move time without sleeping. */ readonly now?: () => number; /** * This site's keypairs (byollm_009 ยง5) โ€” **supplied, never generated here.** * * A site is usually more than one process. Generating keys at startup would * work perfectly in development and fail only in production, silently: each * instance would have a different identity, a daemon would pin whichever * one approved its pairing, and every request routed to a different * instance would fail a signature check it had no way to explain. So this * is a required input, and there is a `keygen` script that produces one. */ readonly siteKeys: StoredKeys; } /** A handled protocol call: a status and a JSON body. */ interface HandlerResult { readonly status: number; readonly body: unknown; /** Set for `rate-limited` and `server-error`. */ readonly retryAfterSeconds?: number; } /** * The five protocol endpoints, over any {@link ByollmStore}. * * Transport-free on purpose: a mount adapts `Request`/`Response` (or Express, * or whatever) onto {@link ByollmHandlers.handle}, and everything the * protocol actually specifies lives here where the conformance kit can reach * it without an HTTP server in the way. */ declare class ByollmHandlers { #private; constructor(config: HandlerConfig); /** * Dispatch one protocol call. * * @param endpoint - which of the five, already routed from the path * @param body - the parsed JSON request body, untrusted * @param auth - the signature and the exact bytes it covers */ handle(endpoint: Endpoint, body: unknown, auth: AuthContext): Promise; } /** The protocol version this build speaks. */ declare const SERVED_PROTOCOL_VERSION: "2"; export { ByollmHandlers as B, type HandlerConfig as H, SERVED_PROTOCOL_VERSION as S, type HandlerResult as a };