import { type Receipt } from './receipt.js'; import { type SigningKey, type VerifyKey } from './keys.js'; export declare const COVERAGE_VERSION: 'conarium-coverage/0.2'; export interface CoverageGap { /** Expected (missing) seq number. */ expectedSeq: number; /** First real seq after the gap. */ foundSeq: number; } export interface CoverageChain { firstSeq: number; lastSeq: number; count: number; contiguous: boolean; gaps: CoverageGap[]; /** False = prefix truncation is invisible. Never a silent complete. */ windowStartPinned: boolean; expectedFirstSeq: number | null; } export interface CoverageDecisions { allow: number; partial: number; deny: number; } export interface CoverageSummary { /** Length of declaredScope. */ declared: number; /** Number of objects whose access was RECORDED (appeared in receipt dataRefs). */ accessed: number; /** Number of objects whose access was NOT RECORDED. NOT "was not accessed". */ notRecorded: number; /** * Number of receipts whose object CANNOT BE DETERMINED. A receipt with empty * dataRefs AND a request.target that is not an object AND a data-access tool * (query/search) cannot answer "which object did this touch". That is NOT the * same as "was not accessed" — absence of a record is ambiguous. When this * counter is greater than zero, the notRecorded list cannot be presented as * "certain"; it also appears in the verifier output. */ unassignedReceiptCount: number; accessedObjects: string[]; notRecordedObjects: string[]; } export interface CoverageSig { alg: 'Ed25519'; keyId: string; value: string; } export interface CoverageDeclaration { v: typeof COVERAGE_VERSION; id: string; ts: string; period: { start: string; end: string; }; declaredScope: string[]; chain: CoverageChain; decisions: CoverageDecisions; coverage: CoverageSummary; sig: CoverageSig; } /** Hash the declaration body (excluding sig). */ export declare function coverageHash(d: Omit): string; /** * Compute the seq range and contiguity from receipts. * Does every value in 1..N appear exactly once? If there is a gap, gaps is filled. */ export declare function computeChain(receipts: Receipt[], opts?: { seqFrom?: number; }): CoverageChain; /** * Compute the decision breakdown from receipts (allow/partial/deny). */ export declare function computeDecisions(receipts: Receipt[]): CoverageDecisions; /** * declaredScope ∩ receipt objects — coverage summary. * notRecorded = objects that are in declaredScope and NEVER appear in receipts. * Meaning is "access was NOT RECORDED" — not "was not accessed". * * An object's "recorded access" can be derived from TWO sources: * 1. dataRefs[].object (query/search result, describe_table target) * 2. request.target — only on tools where the target IS the object itself * (describe_table). Depending on a single source invites the fault of * counting access as "not recorded" when a tool left dataRefs empty. * * Do not silently count "UNKNOWN" as "ABSENT": a receipt with empty dataRefs AND * a target that is not an object AND a data-access tool (query/search) has an * indeterminate object. That cannot be read as "those objects were not accessed" * — it is counted separately via unassignedReceiptCount. list_tables is not data * access (schema listing) and is not counted. */ export declare function computeCoverage(receipts: Receipt[], declaredScope: string[]): CoverageSummary; /** * Produce a coverage declaration. Deterministic (depends on receipts + declaredScope; * id/ts depend on the moment of production). Signed with Ed25519. */ export declare function buildCoverageDeclaration(receipts: Receipt[], declaredScope: string[], key: SigningKey, opts?: { id?: string; ts?: string; seqFrom?: number; }): CoverageDeclaration; /** * Verify the declaration signature. True if valid, false otherwise (fail-closed: * never returns true in any case that cannot be confirmed). */ export declare function verifyCoverageSignature(d: CoverageDeclaration, key: VerifyKey): boolean; /** * Re-verify each receipt Ed25519 signature. A broken sig is not COMPLETE. */ export declare function verifyReceiptSignatures(receipts: Receipt[], keys: VerifyKey[]): { ok: true; } | { ok: false; receiptId: string; reason: string; }; //# sourceMappingURL=coverage.d.ts.map