esigncomply-verify
v1.0.2
Published
Offline verifier for Esign Comply evidence packages: record hash, signed receipt, ledger entry, RFC 3161 timestamp and Merkle inclusion proof, checked with public keys only.
Maintainers
Readme
esigncomply-verify
Offline verifier for Esign Comply evidence packages. It checks an exported package with public keys and timestamp-authority certificates only. It needs no account and no network access, and it does not trust Esign Comply's servers or the customer who exported the package. It keeps working if neither exists any more.
npx esigncomply-verify rec_Z4m8.zipA passing verification shows that the record matches its seal and bounds when it existed. It does not establish who signed or whether any agreement is valid or enforceable.
What it verifies
The checks are the nine steps of FORMAT.md, in order.
| Check | What passing means | Required |
|---|---|---|
| Manifest | Every file listed in manifest.json is present and matches its SHA-256. | no |
| Record hash | sha256(salt \|\| record.json) equals the hash in seal.json. The bytes of record.json are hashed as they are, never re-serialized. | yes |
| Receipt | The ES256 signature of receipt.jws verifies, and the receipt names this record, this hash and this ledger position. The signing key belongs to the record's environment: a receipt signed by a test key never verifies as live. | yes |
| Ledger entry | The entry hash recomputes from the nine fields of seal.ledger and names the record hash. | yes |
| Timestamp | The RFC 3161 token in timestamp.tsr covers the record hash with SHA-256, and its CMS signature verifies under the signing certificate inside the token. | once the seal status is timestamped or anchored |
| Timestamp authority chain | That certificate chains to a trust anchor you supply, and every certificate on the path was valid at the token's time. Runs only with --tsa-roots; otherwise it is reported as skipped. | when roots are supplied |
| Inclusion proof | The ledger entry is a leaf of the Merkle tree whose root a signed checkpoint names (RFC 6962 tree, RFC 9162 verification). | once the seal status is anchored |
| Documents | Each document file hashes to the content hash sealed in record.json. | no |
| Annotations | For each later fact: its data hash recomputes, its ledger entry recomputes, its receipt verifies. | no |
| Customer-supplied material | For each item: its receipt verifies and names its content hash, its ledger entry recomputes, each file matches its hash, and the content hash recomputes from content.json, the file hashes, the subject, the type and occurred_at. Reported in its own section. | no |
Every check is reported as PASS, FAIL or SKIP with the reason. The result
is "verified" only when no check failed and every required check passed. A
check that is not required may be skipped, for example annotations in a package
that has none. A skipped check is never counted as a pass.
What it does not verify
- Who signed. The record holds what the customer asserted about the signer and what Esign Comply observed. Nothing here proves a person's identity.
- Whether an agreement is valid or enforceable. That is a legal question.
- Whether customer-supplied material is true. Its seal shows that the customer sent those bytes no later than the time in the receipt. Esign Comply did not verify the content.
- Revocation of the timestamp authority's certificates. The tool works offline, so it checks signatures and validity periods, not CRLs or OCSP.
- Public anchors.
anchors.json(OpenTimestamps, Rekor) is listed in the report and left to the anchor provider's own tools. - The content hash of a supplement in a package that does not state its
subject. Packages exported before the manifest carried
subject, and withdrawn items, cannot have the hash recomputed. The report says "not recomputed" for that item; its receipt, ledger entry and files are still checked. - The content of an erased or purged record. Such a package has no
record.json. The record hash check is skipped, the seal over the hash is still checked, and the result is "not verified": nothing shows what the record said.
Two limits follow from working offline, and the report states both when they apply:
- Without
--jwks, signatures are checked against the keys inside the package. Someone able to rewrite the whole package could re-sign it with keys of their own. Pass the sealing keys from a source you trust to rule that out. - Without
--tsa-roots, the timestamp token is checked against the certificate inside the token. That shows the token is internally consistent, not which authority issued it.
Test records are sealed with a test key and are always reported as
TEST: no attestation. A test record made on the Free plan has no external
timestamp: its timestamp.json says "simulated": true and there is no token.
The report says "No external timestamp" and does not count it as a pass. A
simulated timestamp on a live record is a failure.
Command line
esigncomply-verify <package.zip | directory> [--jwks <file or https URL>] [--tsa-roots <pem file>] [--json]
esigncomply-verify <certificate.json> --evidence <package.zip> [--jwks …] [--tsa-roots …] [--json]| Option | Meaning |
|---|---|
| --jwks <file \| https URL> | Check signatures against these keys instead of the bundled ones, for example https://esigncomply.com/.well-known/jwks.json or a copy you saved. This is the only option that can use the network, and only with an https:// URL. |
| --tsa-roots <pem file> | Trust anchors for the timestamp authority. Repeatable. |
| --evidence <zip \| dir> | With a certificate: the evidence package of a record it covers. Repeatable. |
| --json | Print the report as JSON. |
Exit code 0 when verified, 1 when not, 2 when the command could not run.
$ esigncomply-verify rec_Z4m8.zip --jwks jwks.json --tsa-roots tsa-root.pem
Evidence package rec_Z4m8
Mode: LIVE
PASS Manifest 17 files are present and match manifest.json.
PASS Record hash sha256:5be7… = sha256(salt || record.json).
PASS Receipt ES256 signature by key esc-us-live-2026-11 (live), checked against the keys supplied by the caller; …
PASS Ledger entry Entry 18244 of the live ledger recomputes to sha256:… and names the record hash.
PASS Timestamp RFC 3161 token over the record hash, 2026-11-21T15:03:22.000Z, signed by "…", serial …
PASS Timestamp authority chain Chain: … (trust anchor). Valid at 2026-11-21T15:03:22.000Z. Revocation was not checked.
PASS Inclusion proof The ledger entry is leaf 48121 of 48130 under signed checkpoint chk_…
PASS Documents 2 of 2 document files match the content hashes sealed in record.json.
SKIP Annotations The package holds no annotations.
SKIP Customer-supplied material The package holds no customer-supplied material.
Result: VERIFIED
A passing verification shows that the record matches its seal and bounds when it existed. It does not establish who signed or whether any agreement is valid or enforceable.Library
The library is plain ES modules on Web Crypto. It runs in Node 20.19 or later and in browsers, and never touches the network.
import { verifyPackage } from "esigncomply-verify";
const report = await verifyPackage(zipBytes, {
jwks, // optional: { keys: [...] } from a source you trust
tsaRoots: [rootPem], // optional: PEM trust anchors for the timestamp authority
});
report.ok; // true only when no check failed and every required check passed
report.attestation; // "live", "none (test record)" or "none (not verified)"
report.checks; // [{ id, title, status: "pass" | "fail" | "skipped", required, detail }]
report.timestamp; // { time, authority, serial, policy } when the token verified
report.checkpoint; // { id, tree_size, time } when the inclusion proof verified
report.documents; // per document
report.annotations; // per annotation
report.customer_supplied; // per supplement, reported apart from the record; content_hash_status says whether its hash was recomputed
report.warnings; // limits that applied to this runverifyPackage takes the ZIP as a Uint8Array, or the files as a map of path
to bytes. In a browser:
const file = input.files[0];
const report = await verifyPackage(new Uint8Array(await file.arrayBuffer()));Also exported:
| Export | Purpose |
|---|---|
| verifyReceipt(jws, jwks) | Verify a signed receipt. Returns { valid, kid, env, typ, payload, error }; env is the environment of the key that signed. |
| verifyCertificate(certificateJson, { evidence?, jwks?, tsaRoots? }) | Check an on-request certificate's hash, receipt and ledger entry, then repeat the record checks for each evidence package supplied. |
| verifyTimestampToken(token, digest, { roots? }) | Check an RFC 3161 token against a 32-byte digest. |
| canonicalize(value) | JSON Canonicalization Scheme (RFC 8785). |
| recordHash(salt, recordJsonBytes) | sha256: hash of a record. |
| ledgerEntryHash(entry) | sha256: hash of a ledger entry. |
| verifyInclusion(leaf, index, treeSize, auditPath, root) | RFC 9162 section 2.1.3.2. |
| verifyConsistency(first, second, firstRoot, secondRoot, proof) | RFC 9162 section 2.1.4.2. |
The hash and tree functions return promises, because Web Crypto is asynchronous.
Format summary
An evidence package is a ZIP file. FORMAT.md is the normative description; in short:
| File | Content |
|---|---|
| manifest.json | Format name and version, record ID, mode, and the SHA-256 of every other file. |
| record.json | The canonical record (RFC 8785): exactly the bytes that were hashed. Absent once the content was erased or purged (seal.json then says content_available: false). |
| seal.json | Record hash, salt, status, key ID and the ledger entry. |
| receipt.jws | Compact JWS (ES256) naming the record, its hash and its ledger position. |
| keys/jwks.json | Public sealing keys valid at seal time, each marked live or test. |
| timestamp.tsr, timestamp.json, validation/ | RFC 3161 token over the record hash, a readable summary, the token's certificates and the validation policy. |
| inclusion-proof.json | Merkle audit path and the signed checkpoint. |
| anchors.json | Public anchors covering the checkpoint. |
| documents/ | The exact bytes of each document version, with a manifest. |
| notice/ | The notice and assent region as captured. |
| annotations.json | Later facts, each with its own ledger entry and receipt. |
| customer_supplied/ | Material the customer sent, each item with its own receipt, its ledger entry and the subject its content hash covers. |
| rules.json, report.pdf, VERIFY.md | Rules applied, the evidence report, and manual verification steps. |
Hashes are SHA-256, lower-case hexadecimal, prefixed sha256:.
- Record hash:
sha256(salt || record.json), salt being 32 bytes. - Ledger entry hash: SHA-256 of
esc-ledger-v1,domain_id,environment,seq,entry_type,subject_id,subject_hash,prev_hash,created_atjoined with line feeds. - Supplement content hash: SHA-256 of the canonical form (RFC 8785) of
{ text, data, files, subject, type, occurred_at },filesbeing the SHA-256 of each file in manifest order. - Merkle tree: leaf
SHA-256(0x00 || entry hash bytes), nodeSHA-256(0x01 || left || right)(RFC 6962).
Development
pnpm --filter esigncomply-verify test
pnpm --filter esigncomply-verify buildThe tests verify a real test-mode package (test/fixtures/sample-test-record.zip),
tamper with it, and build further packages from FORMAT.md with keys made for
the test. test/fixtures/rfc3161-public-tsa.json holds a token from a public
timestamp authority, to check interoperability.
Licence
MIT. See LICENSE.
