npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

attestive-verify

v0.1.1

Published

Standalone, zero-dependency verifier for tamper-evident, hash-chained decision logs.

Readme

attestive-verify

Standalone verifier for tamper-evident, hash-chained decision logs. Zero runtime dependencies beyond Node's built-in node:crypto.

The problem this solves

Some systems keep a log of decisions an AI agent (or any automated system) made — what it saw, what it decided, when. The hard part isn't writing that log. It's proving, later, to someone who doesn't trust the system that produced it, that the log hasn't been quietly edited, that no entry has been deleted, and that the order hasn't been rearranged.

A hash-chained decision log solves the tampering problem the same way a blockchain or a Git commit history does, without needing any of the distributed-consensus machinery: every record's hash is computed from its own content plus the previous record's hash. Change any field in any past record — even by one character — and its hash no longer matches what gets recomputed from its (now-different) content. Because every later record's previousHash was computed from the original hash, the break propagates forward through the entire rest of the chain. Delete a record from the middle, and the gap in sequence numbers is immediately visible. Reorder two records, and their hash links no longer line up.

This package is the thing that checks all of that. It takes an array of records — however you got them, however they're stored — and tells you whether the chain is intact.

Why this is a separate package with zero dependencies

The verification only actually proves anything if the verifier itself can be trusted independently of whoever produced the log. If verifying required importing the vendor's SDK, calling their API, or trusting their database, you'd be back to "trust us" — exactly what a tamper-evidence claim is supposed to make unnecessary.

So this package:

  • Has no dependency on any backend, database, or network call. It is a pure function over an array of JSON-shaped objects.
  • Has no dependency on any vendor SDK. Its only import is Node's built-in node:crypto, for SHA-256.
  • Can be read in full in a few minutes. There is one file (src/verify-chain.ts) and it does one thing.

You can — and should — read the source before trusting it. That's the point.

Install

npm install attestive-verify

Usage

import { verifyChain } from "attestive-verify";
import fs from "node:fs";

const records = JSON.parse(fs.readFileSync("exported-decisions.json", "utf8"));
const result = verifyChain(records);

if (!result.valid) {
  for (const issue of result.issues) {
    console.error(`sequence ${issue.sequenceNumber} (${issue.recordId}): ${issue.problem}`);
  }
  process.exit(1);
}

console.log(`${result.recordsChecked} records verified, chain intact.`);

What a record looks like

verifyChain expects an array of objects matching this shape (exported from the package as DecisionRecord):

interface DecisionRecord {
  id: string;
  sequenceNumber: number;
  organizationId: string;
  agentId: string;
  decisionType: string;
  inputEvidence: Record<string, unknown>;
  output: unknown;
  humanReviewed: boolean;
  humanReviewerId?: string;
  frameworkCitations: FrameworkCitation[];
  timestamp: string;       // ISO 8601
  previousHash: string;    // hex SHA-256 of the prior record, or 64 zeros for the first
  recordHash: string;      // hex SHA-256 of this record's own content + previousHash
}

If you're generating logs in this shape yourself (not using a companion SDK), the hash for each record is sha256(JSON.stringify(orderedFields)) where orderedFields is every field above except recordHash, in a fixed key order, with humanReviewerId defaulting to null when absent. See computeRecordHash in the source for the exact canonical ordering — it has to match exactly, or a correctly-produced record will fail to verify.

What verifyChain checks

For each record, in ascending sequenceNumber order:

  1. Sequence numbers are contiguous, starting at 0. A gap means a record was deleted or two records collided on the same number.
  2. previousHash matches the prior record's recordHash (or 64 zeros — the genesis hash — for the very first record). A mismatch means the chain was broken: a record was deleted, reordered, or replaced.
  3. recordHash matches what's recomputed from the record's own content. A mismatch means this specific record was edited after it was originally hashed.

The result:

interface VerificationResult {
  valid: boolean;
  recordsChecked: number;
  issues: VerificationIssue[];
}

interface VerificationIssue {
  sequenceNumber: number;
  recordId: string;
  problem: string;
}

An empty array verifies as trivially valid (recordsChecked: 0). Records are sorted by sequenceNumber internally before checking, so feeding them in an arbitrary order doesn't itself cause a false failure — an actual reordering attack is still caught, because it breaks the hash links, not because of input order.

What this deliberately does not do

  • No network calls, ever.
  • No opinion on storage — bring your own database, file, or JSON export.
  • No opinion on whether a decision was correct — this checks integrity (did it happen, unaltered, in this order), not judgment.
  • No mutation — verifyChain never writes anything, including to the records you pass in.

Development

npm install
npm test         # runs against source directly (tests/*.test.ts)
npm run typecheck
npm run build    # compiles src/ to dist/, then sanity-checks the compiled output

Worth knowing if you're modifying this package inside its parent monorepo (Attestive): this package's hashing logic is a deliberate standalone copy of the logic used to write records elsewhere in that project (copied, not imported — importing would defeat the point of having zero dependencies). A drift check guarding against the two copies silently diverging exists, but it lives in the parent monorepo's own tests/ directory (tests/verify-chain-cross-check.test.ts), not in this package — it imports the parent's SDK code directly, which only exists there, so it can't live anywhere that git subtree split would carry into this standalone repo. If you're working from a clone of this repo alone, that check isn't something you'll see or need to run; it's a monorepo-side safeguard for whoever maintains both copies in sync.

License

MIT — see LICENSE.