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

sar-envelope

v0.1.0

Published

Portable SAR (Settlement Attestation Receipt) v0.1 envelope primitives: JCS canonicalization, receipt ID derivation, Ed25519 signature-input construction, and .well-known/sar-keys.json key discovery.

Readme

sar-envelope (JS)

Envelope primitives for the portable SAR v0.1 signed core — the six-field task_id_hash, verdict, confidence, reason_code, ts, verifier_kid contract used across SAR (Settlement Attestation Receipt) implementations, including independent implementations on non-EVM/non- wallet rails.

This package implements exactly four things:

  1. JCS (RFC 8785) canonicalizationcanonicalize(value) -> Uint8Array.
  2. Deterministic receipt/claim ID derivationreceiptId(core) = "sha256:" + hex(sha256(JCS(core))).
  3. Ed25519 signature-input constructionsigningInput(core) returns the exact 32 bytes an Ed25519 key signs (the sha256 digest of the JCS-canonicalized core, not the raw canonical JSON bytes).
  4. Key discovery against a published .well-known/sar-keys.json registry (JWK format) — parseKeyRegistry, resolveKey, fetchKeyRegistry, including kid resolution and algorithm binding (only kty=OKP, crv=Ed25519 is recognized).

It does not verify signatures, run a trust registry, implement a CLI, or encode any issuer-specific extension (e.g. a wallet-bound counterparty binding). counterparty and _ext are never part of the six-field signed core this package computes over.

Requires Node 19+ (uses the global crypto.subtle and fetch); also runs unmodified in a browser.

Install

npm install sar-envelope

Example

This reproduces fixture 01_valid_portable from the published conformance corpus (see Fixtures below) byte-for-byte:

import { extractCore, receiptId, signingInput } from "sar-envelope";

const receipt = {
  receipt_version: "0.1",
  task_id_hash: "sha256:fixture-portable-task-0001",
  verdict: "PASS",
  confidence: 1,
  reason_code: "SPEC_MATCH",
  ts: "2026-07-23T00:00:00Z",
  verifier_kid: "fixture-portable-kid-01",
  sig_alg: "Ed25519",
};

const core = extractCore(receipt);
const rid = await receiptId(core);
console.assert(
  rid === "sha256:be6c760480f4127a842d3321774680531caa4a9acf16684c067086f83a8d8b6f"
);

// The bytes an Ed25519 private key signs for this receipt:
const digest = await signingInput(core); // 32 bytes; receiptId hex-encodes this same value

Key discovery against the real published registry format:

import { fetchKeyRegistry, resolveKey } from "sar-envelope";

const registry = await fetchKeyRegistry("https://defaultverifier.com/.well-known/sar-keys.json");
const entry = resolveKey(registry, "sar-prod-ed25519-01");
entry.pubkey; // raw 32-byte Ed25519 public key (Uint8Array)
entry.alg;    // "Ed25519" — only OKP/Ed25519 registry entries are returned

Fixtures

The test suite in this package runs against the canonical Portable SAR v0.1 conformance corpus, bundled at fixtures/portable-sar-fixtures.json and fixtures/portable-sar-fixture-keys.json: https://github.com/nutstrut/sar-envelope/tree/main/js/fixtures

Scope and versioning

Implements SAR v0.1, portable six-field signed-core profile only. Pre-1.0 (0.1.0): the API may change before a 1.0 release. This package computes canonical bytes, receipt IDs, and signature input deterministically from data you supply — it does not itself authenticate a producer's identity, prove human authority over an action, or provide any end-to-end verification guarantee. Signature verification and trust-registry policy (pinning, revocation, refresh) are the caller's responsibility and are out of scope for this package.