> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agntor.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Trust Proxy

> x402 enforcement middleware

# Trust Proxy

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

## Install

```bash theme={null}
npm install @agntor/trust-proxy
```

## Usage

```ts theme={null}
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:

```json theme={null}
{
  "payment_protocol": "x402",
  "x402_proof": { "txHash": "0x..." }
}
```
