New:Socket for Asana Is Now Available.Learn more
Get Started

verify-before-pay

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

verify-before-pay

Verify an x402 counterparty's settlement-grounded reputation before your agent pays it. Drop-in for any x402 client's paymentRequirementsSelector. By Crest / AgentRank.

latest
Source
npmnpm
Version
0.1.2
Version published
Weekly downloads
7
133.33%
Maintainers
1
Weekly downloads
 
Created
Source

verify-before-pay

Before your AI agent releases funds over x402, check the counterparty against AgentRank's settlement-grounded verdict. Drop it into any x402 client's paymentRequirementsSelector so verification runs after the payee is known but before the payment is signed.

The payer-side complement to require-rank (which is the provider side: a service gating its caller).

Why settlement-grounded

A counterfeit agent can fake fluency, a badge, even an on-chain-looking reference. It cannot fake having actually been paid. The verdict here is recomputed from real settled USDC, weighted by payer standing. In a sealed, preregistered experiment, a fake-verifiable counterfeit beat an honest agent 99% of the time without verification; performing the check flipped it, and it held 94% even against an actively lying counterparty. Surface heuristics collapse under mimicry; only verification recovers the truth.

Install & use

import { wrapFetchWithPayment } from "x402-fetch";
import { verifyingSelector } from "verify-before-pay";

// default-on: every payment verifies its counterparty first
const fetchWithPay = wrapFetchWithPayment(
  fetch, wallet, maxValue,
  verifyingSelector({ minScore: 1, onFail: "warn" })   // surface by default; flip to "block" to refuse
);

Or check directly:

import { verifyCounterparty } from "verify-before-pay";
const v = await verifyCounterparty("0xPAYEE..."); // { verified, score, usd, payers, verdict }

Policy (all optional)

optiondefaultmeaning
minScore0require at least this AgentRank score (0–1000) to pass
requireVerifiedfalserequire settlement-verified, not just scored
onFail"warn""warn" (surface + proceed) · "block" (throw) · "allow" (silent)
failClosedfalseon a lookup error, refuse instead of failing open
onCheck(results)callback with every verdict, for logging/telemetry
apiBasehttps://api.agentrank.infoverdict source

Defaults are non-breaking: it always checks and surfaces, never blocks, so installing it can't break a flow. Turn on minScore / requireVerified / onFail:"block" to make it a hard gate. On a verification outage it fails open by default (a verifier outage must not halt your agent).

MIT · by Crest Deployment Systems · https://agentrank.info

Example: classify before paying

See example.mjs — a drop-in payIfTrusted() that classifies the payTo (service / buyer / rail / treasury / dust) and refuses anything that is not a real service, using the free /full counterparty endpoint.

node example.mjs blockrun.ai   # service -> would pay
node example.mjs 0x1111...      # dust    -> would refuse

Keywords

x402

FAQs

Package last updated on 30 Jun 2026

Related posts