import type { Server } from "node:http"; import type { Server as HttpsServer } from "node:https"; import type { Relay } from "./relay.js"; import type { Pinner } from "./pinner.js"; import { CID } from "multiformats/cid"; type ReadBodyResult = { ok: true; body: Uint8Array; } | { error: "too_large" | "timeout" | "empty"; }; /** @internal Exported for testing. */ export declare function readBody(req: AsyncIterable & { destroy(): void; }, timeoutMs?: number): Promise; export interface HttpConfig { port: number; relay: Relay | null; pinner: Pinner | null; pinAppIds: string[]; } export declare function startHttpServer(config: HttpConfig): Server; export type VersionTier = "tip" | "full" | "hourly" | "daily"; export interface RetentionPolicy { fullResolutionMs: number; hourlyRetentionMs: number; dailyRetentionMs: number; } export interface TipResponse { ipnsName: string; cid: string; block: Uint8Array; seq: number; ts: number; peerId: string; guaranteeUntil: number; retainUntil: number; } export interface GuaranteeResponse { ipnsName: string; cid: string; peerId: string; guaranteeUntil: number; retainUntil: number; } export interface HttpsConfig { port: number; key: string; cert: string; corsOrigin: string; rateLimitRpm: number; trustProxy: boolean; /** Blockstore get function — serves raw bytes. */ getBlock: (cid: CID) => Promise; /** Blockstore put function — stores raw bytes. */ putBlock: (cid: CID, bytes: Uint8Array) => Promise; /** History lookup — returns snapshot records for * an IPNS name, filtered to blocks we still have. */ getHistory?: (ipnsName: string) => Promise<{ cid: string; ts: number; }[]>; /** Retention policy for tier classification. */ retentionPolicy?: RetentionPolicy; /** Tip data lookup for GET /tip/:ipnsName. */ getTipData?: (ipnsName: string) => Promise; /** Guarantee lookup for GET /guarantee/:ipnsName. */ getGuarantee?: (ipnsName: string) => GuaranteeResponse | null; /** Record browser activity on HTTP access. */ recordActivity?: (ipnsName: string) => void; } export declare function startBlockServer(config: HttpsConfig): HttpsServer; export {}; //# sourceMappingURL=http.d.ts.map