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

agentgraph-trust

v0.1.0

Published

Client-side verification of AgentGraph Trust Score v2 signed envelopes (JCS-canonical, Ed25519-over-SHA-256). Peer of the Python agentgraph-sdk verify module.

Readme

agentgraph-trust

JavaScript/TypeScript SDK for AgentGraph Trust Score v2 — signed, self-verifiable trust-score envelopes. This is the JS peer of the Python agentgraph-sdk verify module; both reproduce the server's JCS-canonical, Ed25519-over-SHA-256 verification byte-for-byte.

  • Zero crypto deps: uses Node's built-in node:crypto for Ed25519.
  • One runtime dep: canonicalize (RFC 8785 JCS — byte-matches Python's rfc8785).
  • Node >= 18 (uses the global fetch).

Install

npm install agentgraph-trust

Trust Score v2 — signed, self-verifiable envelopes

Every v2 trust score is a signed envelope you can verify without trusting our server — fetch it, then check the Ed25519 signature against our published JWKS yourself.

import { TrustClient } from 'agentgraph-trust';

const client = new TrustClient('https://agentgraph.co');
const did = 'did:web:agentgraph.co:agents:<id>';

// Signed envelope: score + per-source methodology breakdown + proof
const env = await client.getAggregate(did);
console.log(env.trust_score, env.contributions.map((c) => c.source));

// Verify it client-side (fetches JWKS, checks signature + freshness)
const result = await client.verify(did);
if (result.valid) {            // true iff signature valid AND fresh
  console.log('verified:', result.kid);
} else {
  console.log('NOT verified:', result.reason);
}

// Scan any GitHub repo -> grade + findings + a verifiable envelope
const scan = await client.checkRepo('owner', 'repo');
if (scan.trust_envelope) {
  console.log(await client.verifyEnvelope(scan.trust_envelope));
}

Standalone verification (no client)

verifyEnvelope(envelope, jwks, { now }) only needs canonicalize plus node:crypto, reproducing the server's JCS-canonical, Ed25519-over-SHA-256 check byte-for-byte.

import { verifyEnvelope } from 'agentgraph-trust';

const result = verifyEnvelope(envelope, jwks);
// => { valid, signatureValid, fresh, kid, reason }

It (1) strips the top-level proof key, (2) JCS-canonicalizes the rest, (3) SHA-256s it, (4) reads kid from the detached JWS header, (5) finds the matching { kty: 'OKP', crv: 'Ed25519', x } key in the JWKS, (6) verifies the Ed25519 signature over the digest, then (7) checks computed_at + freshness_ttl_seconds >= now. valid is signatureValid && fresh.

API

new TrustClient(baseUrl, { apiKey?, token?, timeout? })

| Method | Description | |--------|-------------| | getAggregate(did) | Signed v2 envelope for a subject DID | | getContributions(did) | Just the methodology breakdown | | checkRepo(owner, repo) | Scan a GitHub repo -> grade + findings + envelope | | getJwks() | Issuer JWKS from <baseUrl>/.well-known/jwks.json | | verifyEnvelope(env, { now? }) | Fetch JWKS + verify an envelope client-side | | verify(did, { now? }) | getAggregate + verifyEnvelope in one call |

API base is <baseUrl>/api/v1; the JWKS is served outside that prefix.

verifyEnvelope(envelope, jwks, { now? })

Returns { valid, signatureValid, fresh, kid, reason }. reason is one of: ok, missing or unsupported proof, malformed jws, no matching key in JWKS, signature invalid, envelope expired (stale).

Also exported: envelopeDigest(envelope) (raw 32-byte SHA-256 of the JCS-canonical, proof-stripped envelope), isFresh(envelope, { now? }), PROOF_TYPE.

Verification / tests

npm install
npm test          # node --test

The test suite validates against production: it fetches the real JWKS and a real signed aggregate from agentgraph.co and asserts the JS verifier accepts it (valid === true, kid === 'trust-v2-2026'). A passing live check proves byte-compatible JCS canonicalization + Ed25519 with the Python/server side. If prod is unreachable it falls back to a pinned fixture captured from prod.

Spec

docs/standards/trust-score-envelope-v2.0.md (§6 verification). MIT licensed.