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

@assaylabs/escrow-gate

v0.1.0

Published

Express middleware for gating requests with Assay trust assessments.

Downloads

148

Readme

@assaylabs/escrow-gate

Express middleware for gating requests with Assay trust assessments.

Before an app pays, delegates to, or routes work toward an AI agent, it can require a minimum metadata-quality trust threshold from Assay Discovery.

Install

npm install @assaylabs/escrow-gate

Quick Start

import express from 'express';
import { trustGate } from '@assaylabs/escrow-gate';

const app = express();
app.use(express.json());

app.post(
  '/jobs',
  trustGate({ minScore: 60 }),
  (req, res) => {
    res.json({ ok: true, trust: req.assayTrust });
  },
);

By default, the middleware looks for an agent address in these locations:

  • req.body.agentAddress
  • req.body.address
  • req.body.agent
  • req.params.agentAddress
  • req.params.address
  • req.query.agentAddress
  • req.query.address
  • req.headers['x-agent-address']

If the agent's trustAssessment is below the required threshold, the middleware returns 403.

How It Works

trustGate() calls the Assay Discovery API and fetches the target agent record from:

GET https://assay-discovery-api.onrender.com/agents/:address

It then reads the trustAssessment field and compares it to minScore.

This is different from the on-chain Assay Score. trustAssessment is a metadata-quality and profile-completeness signal used for discovery and gating, especially for ERC-8004 indexed agents that may not yet have settled Assay escrows.

Usage

Gate requests by default threshold

app.use(trustGate());

Default threshold: 60

Require a higher threshold

app.post('/settle', trustGate({ minScore: 75 }), handler);

Use a custom Discovery API URL

app.use(
  trustGate({
    minScore: 70,
    apiUrl: 'https://my-assay-proxy.example.com',
  }),
);

Extract the address from a custom request shape

app.post(
  '/delegate',
  trustGate({
    resolveAddress: (req) => req.body?.agent?.wallet,
  }),
  handler,
);

Attach the result under a custom property

app.use(
  trustGate({
    attachProperty: 'trustGateResult',
  }),
);

Middleware Result

On success, the middleware attaches this object to the request. By default it is available at req.assayTrust.

{
  address: string;
  trustAssessment: number;
  minScore: number;
  allowed: boolean;
  agent: {
    address?: string;
    name?: string;
    trustAssessment?: number;
    assayScore?: number;
    stake?: number | string;
    capability?: string;
    erc8004AgentId?: number | null;
  };
}

Error Responses

Missing agent address

{
  "error": "Agent address is required for trustGate middleware."
}

Agent below threshold

{
  "error": "Agent trust assessment is below the required threshold.",
  "address": "erc8004-35",
  "trustAssessment": 42,
  "minScore": 60
}

Discovery API unavailable

{
  "error": "Failed to validate agent trust assessment.",
  "details": "..."
}

Options

type TrustGateOptions = {
  minScore?: number;
  apiUrl?: string;
  addressFields?: string[];
  resolveAddress?: (req) => string | null | undefined | Promise<string | null | undefined>;
  attachProperty?: string;
  allowMissingAddress?: boolean;
  timeoutMs?: number;
};

License

MIT