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

@noidme/ledger

v0.1.0-beta.0

Published

Tamper-evident consent ledger + enforcement evidence. Append each consent action (grant/deny/withdraw/gpc) to a hash-chained record (GDPR Art. 7, 100% unsampled); pass a server-held HMAC sealKey to make the chain forgery-resistant. Plus per-vendor enforce

Readme

@noidme/ledger

Zero-dependency tamper-evident consent ledger + enforcement evidence. Append every consent action to a hash-chained record (GDPR Art. 7, 100% unsampled); pass a server-held HMAC sealKey to make the chain forgery-resistant. Aggregate per-vendor enforcement counts with a confidence-interval helper for honest sampled reporting.

Extracted from noidme.js; usable standalone.

Install

npm i @noidme/ledger

Consent ledger

import { ConsentLedger } from '@noidme/ledger';

const ledger = new ConsentLedger();

await ledger.record({
  subjectId: 'anon-8f3a',      // pseudonymous — hashed into the immutable chain, never raw PII
  property: 'example.com',
  region: 'EU',
  policyVersion: 3,
  purposes: { analytics: true, advertising: false },
  action: 'grant',            // 'grant' | 'deny' | 'withdraw' | 'gpc'
  mechanism: 'banner',        // 'banner' | 'api' | 'gpc' | 'import'
});

await ledger.verify();        // true — chain intact (nothing altered or internally reordered)
ledger.query({ subjectId: 'anon-8f3a' });
const dsar = ledger.export(); // JSON string, DSAR-ready

Integrity model — read this, it has three tiers

  1. Plain SHA-256 chain (no key) detects accidental corruption and internal reordering. It is not forgery-proof: anyone who can edit the records can recompute a consistent chain, because the hash binds no secret.
  2. HMAC seal (server-side) — pass a sealKey the client never sees, and the chain becomes keyed → unforgeable without the key. This is the tamper-evidence you can stand behind.
  3. Head anchor — a hash chain cannot detect truncation of its own tail or total erasure: a prefix of a valid chain is itself a valid chain, and [] verifies as intact. To catch a dropped withdrawal you must commit to the head out of band: persist ledger.head() and pass it as expected to verifyChain.
// On the backend, holding an HMAC key the client never sees:
const sealKey = await crypto.subtle.importKey('raw', keyBytes, { name: 'HMAC', hash: 'SHA-256' }, false, ['sign']);
const ledger = new ConsentLedger({ sealKey });
// ...record()...

const head = ledger.head();   // { count, lastHash } — persist this in YOUR database

// Later, verifying an imported/DSAR chain:
await ConsentLedger.verifyChain(records, {
  sealKey,                    // forgery-resistant
  expected: head,             // catches truncation + total erasure
  maxRecords: 100_000,        // refuse (→ false) an oversized untrusted array
});

Pseudonymize before recording. record() hashes every field (subjectId, region, purposes, …) verbatim into the immutable chain — the ledger is append-only, so it cannot be your erasure point. Keep raw identity in a separate mapping you can delete, and record only a pseudonymous subjectId.

Enforcement evidence

import { EnforcementEvidence, withConfidenceInterval } from '@noidme/ledger';

const ev = new EnforcementEvidence();
ev.record('doubleclick.net', 'block');   // 'allow' | 'block' | 'quarantine' | 'override'
ev.total;                                 // { allow, block, quarantine, override }
ev.export(0.1);                           // per-vendor counts + CI'd population estimates (10% sample)

withConfidenceInterval(100, 0.1);         // { estimate: 1000, ciLow, ciHigh } — 95% Wald CI

sampleRate must be in (0, 1]1 is a full census (exact). A zero observed count returns the one-sided 95% Poisson upper bound (not a false-precision [0, 0]). Invalid input (observed not a non-negative integer, sampleRate outside (0, 1] or NaN) throws — a silent NaN in a regulator-facing figure is worse than an error.

API

  • class ConsentLedgerrecord(input), verify(), head(), query(filter), all(), export(), size; static ConsentLedger.verifyChain(records, opts?) where opts = { sealKey?, expected?: LedgerHead, maxRecords? }.
  • class EnforcementEvidencerecord(vendor, action) (throws on an unknown action), total, export(sampleRate?).
  • withConfidenceInterval(observed, sampleRate){ estimate, ciLow, ciHigh }.

record() validates its input and throws on anything that wouldn't hash losslessly (non-finite policyVersion, non-boolean purpose values, unknown action/mechanism). Committed records are frozen — you can't mutate one out from under the chain.

Uses WebCrypto (crypto.subtle) — available in modern browsers and Node 18+.

License

MIT