import type { HttpBindings } from "@hono/node-server"; import { Hono } from "hono"; import type { UpgradeWebSocket } from "hono/ws"; import type { WebSocket } from "ws"; import type { E2eeContext } from "../e2ee/context"; import type { Principal } from "../services/security/capabilities"; import type { ApiDeps } from "./types/api-deps"; export type AppEnv = { Bindings: HttpBindings; Variables: { requestId?: string; validatedBody?: unknown; validatedQuery?: unknown; /** Who is making this request (C5). Set by authMiddleware. */ principal?: Principal; /** * The E2EE context this request authenticated under, if any. * * **ONE declaration, deliberately, for two setters.** W1b's `/ws` upgrade * and X-server's REST unseal both need this field, and both branches added * it independently; two declarations of the same optional key merge in * TypeScript and compile, right up until the two comments disagree about * what the field means. Set by `authMiddleware` when a `/ws` upgrade * presents a live ticket and read by the WebSocket route; set by * `e2eeEnvelopeMiddleware` when a REST request unseals under `X-TB-Ctx`. * * It is here rather than in a module-level map because the setter and the * reader are separated by an `await` — a shared variable would let two * concurrent upgrades swap contexts. * * Absent on every plaintext request, which is what `refuseUnsealedIfPinned` * reads as "this request was not sealed". */ e2eeContext?: E2eeContext; }; }; /** * The query string with only its numeric values kept. * * Pagination is the thing the log needs to show (`limit`, `offset`, * `before_index`, `msg_limit`), and those are numbers. Everything else — * `?path=/Users/...`, ids, search terms — is a value we deliberately do not * log, so the key is kept and the value is dropped. Returns undefined for a * bare path so the field stays absent rather than empty. * * Deliberately NOT blanket numeric redaction: `limit=50` must keep logging its * value, or the fix costs the diagnostics this field exists for. */ export declare function summarizeQuery(query: Record): string | undefined; export declare const createHonoApp: (deps: ApiDeps, upgradeWebSocket?: UpgradeWebSocket) => Hono; //# sourceMappingURL=app.d.ts.map