@tryengrave/verify
v0.1.3
Published
Standalone offline verifier for Engrave proofs. Runs in Node, Bun, Deno, Workers, and the browser.
Readme
@tryengrave/verify
A standalone, offline verifier for Engrave proofs. Give it a proof and a pinned public key; it recomputes the entire chain and tells you true or false — with no network call and no trust in Engrave. Runs in Node, Bun, Deno, Cloudflare Workers, and the browser.
npm install @tryengrave/verifyWhy this exists
The whole value of Engrave is that you don't have to trust it. A server that answers "verified": true is just vouching for itself. This package hands verification to you: it re-derives the entry digest, walks both Merkle paths, recomputes the transaction hash, and checks the Ed25519 signature over the tree head — locally.
If this returns true, the event existed, in that order, unaltered. If Engrave ever forked or rewrote history, the math fails here, on your machine.
Usage
import { verifyDualInclusion, verifyExportPack } from "@tryengrave/verify"
// Verify a single entry's dual inclusion proof against a pinned key
const result = verifyDualInclusion(proof, pinnedPublicKey)
if (!result.ok) throw new Error(`failed at ${result.step}: ${result.detail}`)
// Verify a whole evidence pack offline (e.g. an export handed to an auditor)
const pack = verifyExportPack(exportJson, pinnedPublicKey)API
verifyDualInclusion(proof, key)— entry → transaction root → signed tree head.verifyConsistency(proof)— a later tree is an append-only extension of an earlier one.verifyAlhChain(...)— the accumulator-linked-hash chain across transactions.verifySth(sth, key)— the Ed25519 signature over a signed tree head.verifyExportPack(pack, key)— verify an entire self-contained evidence pack.
Every function returns a Result-style { ok, step, detail } so a failure tells you exactly which check broke.
Part of Engrave — immutable audit evidence, verifiable by anyone. · Docs · MIT
