/** * OpenTimestamps anchor adapter. * * Submits ONLY the 32-byte SHA-256 of the chain head to one or more public * OpenTimestamps calendar servers, stores the returned `.ots` proof, and can * later upgrade that proof to a Bitcoin block attestation. Nothing else leaves * the process (zero data plane): a hash is submitted, an `.ots` proof comes * back. No decision content, policy, scope, amount, model identity, or key * material is ever transmitted. * * This adapter uses the real `opentimestamps` npm library through an injectable * boundary (`OtsLib`), so: * - `anchor()` builds a `DetachedTimestampFile` from the raw digest, stamps it * against public calendars, and stores the serialized `.ots` bytes, * - `upgrade()` fetches the Bitcoin attestation when the calendars have it and * persists the upgraded `.ots` (idempotent), * - `verify()` reports `attested: true` with a real `when` ONLY when the `.ots` * proof actually carries a Bitcoin block-header attestation. A pending proof * stays pending. An attested time is NEVER fabricated. * * Patent notice: Protected by U.S. patent-pending technology * (App. Nos. 63/983,615; 63/983,621; 63/983,843; 63/984,626; * 64/071,781; 64/071,789). */ import type { AnchorProof, AnchorVerification, TimestampAnchor } from './types'; /** Public OpenTimestamps calendar servers (aggregators). */ export declare const DEFAULT_OTS_CALENDARS: string[]; /** * Result of inspecting an `.ots` proof for a Bitcoin attestation. * `bitcoinAttested` is true iff the timestamp carries a Bitcoin block-header * attestation; `attestedTimeSec` is the confirmed block time (unix seconds), * only present when the attestation resolves to a real time. */ export interface OtsBitcoinAttestation { bitcoinAttested: boolean; attestedTimeSec?: number; height?: number; } /** * The `opentimestamps` library boundary. Injectable so tests are deterministic * and never touch the network. Every method receives/returns raw bytes and the * 32-byte digest only — zero data plane. */ export interface OtsLib { /** Stamp a 32-byte SHA-256 digest against calendars; return the `.ots` bytes. */ stamp(sha256Digest: Uint8Array, calendars: string[]): Promise; /** Upgrade stored `.ots` bytes (fetch Bitcoin attestation if available). Idempotent; returns the possibly-upgraded `.ots` bytes. */ upgrade(otsBytes: Uint8Array): Promise; /** Inspect `.ots` bytes for the given digest. MUST throw if the proof's embedded file hash does not equal `sha256Digest`. */ verify(sha256Digest: Uint8Array, otsBytes: Uint8Array): Promise; } /** * @deprecated Legacy calendar-POST transport hook. Superseded by the `OtsLib` * boundary now that the real `opentimestamps` library is a dependency. Retained * only so existing type imports keep compiling. */ export type OtsSubmit = (calendarUrl: string, digest: Uint8Array) => Promise; export interface OpenTimestampsAnchorOptions { calendars?: string[]; /** Override the OpenTimestamps library boundary (defaults to the real npm lib). */ lib?: OtsLib; } /** * Default `OtsLib` backed by the real `opentimestamps` npm package. Lazily * required so the SDK never pulls the library (or node:https) at import time in * bundlers — only when an anchor is actually exercised. */ export declare function defaultOtsLib(): OtsLib; export declare class OpenTimestampsAnchor implements TimestampAnchor { readonly type = "opentimestamps"; private readonly calendars; private lazyLib; constructor(options?: OpenTimestampsAnchorOptions); private lib; private digestOf; anchor(headHashHex: string): Promise; /** * Fetch the Bitcoin attestation for a stored proof, if the calendars now have * it, and return an updated proof. Idempotent: safe to call repeatedly. If the * attestation is confirmable, `attestedAt` is set to the real Bitcoin block * time and status becomes `complete`; otherwise the proof stays `pending`. */ upgrade(proof: AnchorProof): Promise; verify(headHashHex: string, proof: AnchorProof): Promise; } //# sourceMappingURL=opentimestamps.d.ts.map