/** * Whole-ledger verification: keyring, every segment line (signature, key * window, writer and seq binding, chain, record hash, scope, identity), the * index/segment agreement, the local checkpoint chain, and the latest * checkpoint from the independent sink (truncation and deletion). * * @see docs/contracts/effect-ledger.v1.md */ import type { CheckpointSink } from './checkpoint-sinks.js'; import type { EffectLedger } from './ledger.js'; import { type LedgerPaths } from './store.js'; import { type EffectCheckpoint, type EffectCheckpointBody, type EffectKeyring, type EffectScope } from './types.js'; export interface LedgerVerifyFailure { reason: string; writer?: string; seq?: number; checkpoint?: number; } export interface LedgerVerification { ok: boolean; exitCode: 0 | 6; scope: EffectScope; records: number; writers: Array<{ writer: string; count: number; headHash: string | null; }>; checkpoint: { sequence: number; source: 'sink' | 'local'; digest: string; } | null; failures: LedgerVerifyFailure[]; warnings: string[]; } export interface VerifyLedgerOptions { /** Checkpoint sink to compare against. Defaults to the ledger's sink; null skips it. */ sink?: CheckpointSink | null; /** Check index/segment agreement. Default true. */ checkIndex?: boolean; /** Host-pinned genesis key IDs. When given, the keyring must descend from one of them. */ trustedKeyids?: string[]; } /** `"sha256:"` plus hex SHA-256 of `canonicalJson(checkpoint)`, as used by `previousCheckpoint`. */ export declare function checkpointDigest(checkpoint: EffectCheckpoint): string; export declare function checkpointBody(checkpoint: EffectCheckpoint): EffectCheckpointBody; /** * Digests of the keyring as it stood after each rotation (0..n). A checkpoint's * `keyringDigest` must equal one of them, so a later keyring can only extend * the one the checkpoint anchored, never replace or re-window it. */ export declare function keyringPrefixDigests(keyring: EffectKeyring): string[]; /** Schema, scope, root, keyring lineage and signature checks for one checkpoint. Returns a failure reason or null. */ export declare function checkpointFailure(checkpoint: unknown, keyring: EffectKeyring, scope: EffectScope): string | null; export declare function readLocalCheckpoints(paths: LedgerPaths): Promise>; /** * Verify the whole ledger for this scope. Integrity failures are reported, not * thrown (exit 6); an unavailable artifact root still throws (exit 7). */ export declare function verifyLedger(ledger: EffectLedger, options?: VerifyLedgerOptions): Promise; //# sourceMappingURL=verify.d.ts.map