@moltrust/x402
March 9, 2026 · View on GitHub
MolTrust trust verification middleware for x402 payments. Checks the paying agent's MoltGuard reputation score before allowing payment flow.
Install
npm install @moltrust/x402
Hono
import { Hono } from "hono";
import { moltrustGuard } from "@moltrust/x402";
const app = new Hono();
app.use(moltrustGuard({ minScore: 50 }));
Express
import express from "express";
import { moltrustGuard } from "@moltrust/x402/express";
const app = express();
app.use(moltrustGuard({ minScore: 50 }));
How it works
- Extracts wallet address from the
X-PAYMENTheader - Calls MoltGuard's free agent scoring endpoint
- Returns
403if score is belowminScore - Passes through if score is OK
- Fails open if MoltGuard is unreachable (never blocks payments on downtime)
Options
| Option | Type | Default | Description |
|---|---|---|---|
minScore | number | 50 | Minimum score (0–100) to allow |
apiUrl | string | https://api.moltrust.ch/guard | MoltGuard API base URL |
timeout | number | 3000 | Timeout in ms |
License
MIT — moltrust.ch