import { type CountersignSig } from './anchor-sign.js'; import type { SigningKey } from './keys.js'; export type AnchorRecordType = 'submit' | 'upgrade' | 'stamp'; export interface AnchorRecord { type: AnchorRecordType; id: string; /** Customer-submitted digest (`sha256:…`). Public views expose this as `digest`. */ digest: string; /** Entry hash — same rule as audit-hash.ts (`hash`/`sig`/`anchor` excluded). */ hash: string; owner: string; log: 'opentimestamps'; ots: string; state: 'pending' | 'bitcoin'; bitcoinBlock?: number; submittedAt: string; upgradedAt?: string; seq: number; prevHash: string; /** Set on `type: 'upgrade'` — the submit/stamp seq this row confirms. */ upgradesSeq?: number; /** Set on `type: 'stamp'` — the log seq whose entry hash was sent to calendars. */ stampedSeq?: number; sig: CountersignSig; } export interface AnchorServiceOptions { /** JSONL store. Append-only: an anchoring log that can be rewritten is not one. */ storePath: string; /** token -> owner id. Anonymous writes would let anyone fill the disk. */ tokens: Map; /** Live lookup. Used so the process can reload the token file without a restart. */ getTokens?: () => Map; /** Public base URL, used to build the permanent verification address. */ publicBaseUrl: string; /** Required. A countersign service that can start without a key is not one. */ signingKey: SigningKey; /** Override the derived public PEM (tests). Still refused if it looks private. */ publicPem?: string; submitsPerMinute?: number; /** Injected in tests so the suite never touches a calendar server. */ stamp?: (digest: Buffer) => Promise; upgrade?: (otsBase64: string) => Promise<{ upgraded: boolean; block?: number; ots?: string; }>; } /** Reads every record. Does not validate the chain — use readLiveStore. */ export declare function readStore(path: string): AnchorRecord[]; export declare function validateAnchorLog(rows: AnchorRecord[]): void; export declare function readLiveStore(path: string): AnchorRecord[]; export interface InclusionLink { seq: number; hash: string; prevHash: string; } export interface InclusionProof { seq: number; hash: string; prevHash: string; head: { seq: number; hash: string; state: 'pending' | 'bitcoin'; bitcoinBlock?: number; }; path: InclusionLink[]; } export declare function buildInclusionProof(rows: AnchorRecord[], target: AnchorRecord): InclusionProof; export declare function verifyInclusionProof(record: { seq: number; hash: string; prevHash: string; }, proof: InclusionProof): boolean; export declare function loadTokensFile(path: string): Map; /** * `_conarium_sync` marks a successful pull. A missing/unreadable file is not * authoritative — the running process keeps the last good set. */ export declare function readTokensSnapshot(path: string): { tokens: Map; authoritative: boolean; }; export declare function createAnchorService(opts: AnchorServiceOptions): { app: import("express-serve-static-core").Express; runUpgrade: () => Promise<{ checked: number; upgraded: number; }>; runStamp: () => Promise<{ attempted: number; stamped: number; }>; readStore: () => AnchorRecord[]; }; //# sourceMappingURL=anchor-service.d.ts.map