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

@trstlyr/sdk

v0.0.1

Published

Lightweight SDK for querying trust scores and posting behavioral attestations to the TrstLyr API

Readme

@trstlyr/sdk

Lightweight, zero-dependency SDK for the TrstLyr trust API. Query trust scores and post behavioral attestations in one line.

Works in Node.js 18+, Bun, Deno, and browsers.

Install

npm install @trstlyr/sdk

Quick Start

import { score, attest, behavioral, isTrusted, gate } from '@trstlyr/sdk';

// Query a trust score
const result = await score('github:vbuterin');
console.log(result.trust_score, result.risk_level, result.recommendation);

// Simple boolean check
if (await isTrusted('erc8004:31977', 60)) {
  // proceed
}

// Gate — throws TrustGateError if score < threshold
const trustResult = await gate('erc8004:31977', { minScore: 60 });

// On-chain attestation (EAS on Base)
const att = await attest('github:tankcdr');
console.log(att.attestation_uid, att.attestation_url);

// Behavioral attestation after an interaction
await behavioral({
  subject: 'erc8004:31977',
  outcome: 'success',
  rating: 5,
  value_usd: 100,
});

Client Class

For more control, instantiate TrstLyrClient directly:

import { TrstLyrClient } from '@trstlyr/sdk';

const client = new TrstLyrClient({
  apiKey: process.env.TRSTLYR_API_KEY,
  baseUrl: 'https://api.trstlyr.ai',
  timeout: 5000,
});

const result = await client.score('github:vbuterin');
const history = await client.behaviorHistory('erc8004:31977');

Middleware

Express

import { trustGate } from '@trstlyr/sdk/middleware';

app.use(trustGate({
  subjectFrom: (req) => req.headers['x-agent-id'] as string,
  minScore: 60,
  onBlock: (subject, score) => ({
    status: 403,
    message: `Agent ${subject} blocked: score ${score?.trust_score}`,
  }),
}));

Fastify

import { trustGateHook } from '@trstlyr/sdk/middleware';

server.addHook('onRequest', trustGateHook({
  subjectFrom: (req) => req.headers['x-agent-id'] as string,
  minScore: 60,
}));

Fail-Open by Default

If the TrstLyr API is unreachable, the SDK logs a warning but does not throw. This prevents trust-check timeouts from killing your agent. To fail closed instead:

import { gate, configure } from '@trstlyr/sdk';

// Functional API
await gate('erc8004:31977', { minScore: 60, strictMode: true });

// Client
const client = new TrstLyrClient({ strictMode: true });

// Middleware
app.use(trustGate({ subjectFrom: ..., strictMode: true }));

Subject Format

Subjects follow the namespace:id pattern:

| Namespace | Example | |-----------|---------| | github | github:vbuterin | | erc8004 | erc8004:31977 | | twitter | twitter:vaborin | | ens | ens:vitalik.eth | | wallet | wallet:0xAbc... |

URLs are also accepted — the API normalizes them automatically.

Error Types

| Error | When | |-------|------| | TrstLyrError | Base error for any API failure | | TrustGateError | Subject's score is below the gate threshold | | PaymentRequiredError | x402 — query requires payment |

License

Apache-2.0