Skip to main content

Trust Proxy

@agntor/trust-proxy validates X-AGNTOR-Proof headers and enforces x402 constraints.

Install

npm install @agntor/trust-proxy

Usage

import express from 'express';
import { createTrustProxy } from '@agntor/trust-proxy';
import { TicketIssuer } from '@agntor/sdk';

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

const issuer = new TicketIssuer({
  signingKey: process.env.AGNTOR_SECRET_KEY!,
  issuer: 'agntor.com',
});

app.use('/api/agent', createTrustProxy({ issuer }));

x402‑Only Enforcement

If a ticket has requires_x402_payment: true, requests must include:
{
  "payment_protocol": "x402",
  "x402_proof": { "txHash": "0x..." }
}