import { type HistoryChunkEntry } from "@gryt/crypto"; import type { HistoryProgress, HistorySink, PairingClock } from "./interfaces.js"; import { type PairingRelay } from "./relayClient.ts.js"; export interface HistoryReceiverOptions { relay: PairingRelay; id: string; token: string; key: Uint8Array; sink: HistorySink; clock: PairingClock; signal: AbortSignal; onProgress(progress: HistoryProgress): void; } /** N: fetches each listed chunk newest first, checks it against its entry, and stores each message once. */ export declare function createHistoryReceiver(options: HistoryReceiverOptions): { done: Promise; progress: () => { messages: number; total: number | null; chunks: number; listed: number; missing: number; refused: number; truncated: boolean; oldest: number | null; complete: boolean; }; /** The envelope's manifest: slots 0 onwards, in order. */ listManifest(chunks: readonly HistoryChunkEntry[]): void; /** One of A's history messages. Throws `tampered` for anything off. */ list(message: Record): void; /** The session is gone: whatever is still listed won't arrive. */ abandon: () => void; };