@crestdeploymentsystems/trusted-fetch
v1.0.0
Published
x402 fetch with pre-payment trust check. Drop-in replacement for @x402/fetch that calls supership before paying.
Downloads
30
Maintainers
Readme
@crestdeploymentsystems/trusted-fetch
x402 payments with pre-payment trust verification. Drop-in replacement for @x402/fetch that checks service trust before sending money.
Install
npm install @crestdeploymentsystems/trusted-fetchUsage
import { wrapFetchWithPayment } from "@x402/fetch";
import { createTrustedFetch } from "@crestdeploymentsystems/trusted-fetch";
// Your normal x402 setup
const fetchWithPayment = wrapFetchWithPayment(fetch, client);
// Wrap it with trust verification
const trustedFetch = createTrustedFetch(fetchWithPayment, {
threshold: 50, // minimum trust score (0-100)
onCheck: (url, trust) => console.log(`${url}: ${trust.score}/${trust.grade}`),
onRefuse: (url, trust) => console.log(`Refused to pay ${url}: score too low`),
});
// Use exactly like fetchWithPayment -- but safe
const res = await trustedFetch("https://some-x402-service.com/api/data", {
method: "GET",
});How it works
Before every x402 payment, trustedFetch calls supership.crestsystems.ai/check to get a trust score for the service. If the score is below your threshold, the payment is refused and an error is thrown. Your money stays in your wallet.
The check is free. Skipping it is expensive.
Options
| Option | Default | Description |
|--------|---------|-------------|
| threshold | 50 | Minimum trust score (0-100) to proceed with payment |
| checkUrl | supership.crestsystems.ai/check | Trust check endpoint |
| onCheck | null | Callback after every trust check |
| onRefuse | null | Callback when payment is refused |
Why
Agents making x402 payments have no way to know if a service is trustworthy before paying. trusted-fetch adds a pre-flight trust check that protects against:
- Scam services that take payment and return nothing
- Services with known security issues
- Newly deployed services with no track record
- Services that have degraded since you last called them
Built by
Crest Deployment Systems -- deploying scalable intelligence.
