
Product
Microsoft Teams Notifications Are Now Available in Socket
Socket can now send alerts and supply chain attack notifications to Microsoft Teams, with filters that route the right updates to each channel.
@agntor/trust-proxy
Advanced tools
Express middleware for x402 transaction validation with Agntor audit tickets
Express middleware for x402 transaction validation with Agntor audit tickets. Includes prompt injection guard, JWT proof validation, and PII redaction.
npm install @agntor/trust-proxy @agntor/sdk express
import express from 'express';
import { createTrustProxy } from '@agntor/trust-proxy';
import { TicketIssuer } from '@agntor/sdk';
const app = express();
app.use(express.json());
// Initialize issuer
const issuer = new TicketIssuer({
signingKey: process.env.AGNTOR_SECRET_KEY!,
issuer: 'agntor.com',
});
// Apply trust proxy to protected routes
app.use('/api/agent', createTrustProxy({ issuer }));
// Protected endpoint
app.post('/api/agent/execute', (req, res) => {
// Access validated agent info
const { agentId, auditLevel } = req.agntor!;
res.json({
message: 'Transaction approved',
agent: agentId,
level: auditLevel,
});
});
app.listen(3000);
createTrustProxy(config: TrustProxyConfig)Creates the trust validation middleware.
Config Options:
{
issuer: TicketIssuer; // Required
headerName?: string; // Default: 'x-agntor-proof'
requireProof?: boolean; // Default: true
validateTransactionValue?: boolean; // Default: true
transactionValuePath?: string; // Default: 'amount'
mcpServerPath?: string; // Default: 'mcp_server'
paymentProtocolPath?: string; // Default: 'payment_protocol'
x402PaymentProofPath?: string; // Default: 'x402_proof'
onError?: (error, req, res) => void; // Custom error handler
onSuccess?: (result, req) => void; // Success callback
}
strictTrustProxy(config) - Always requires and validates proof
optionalTrustProxy(config) - Logs but doesn't block invalid tickets
When a ticket includes requires_x402_payment: true, requests must include:
payment_protocol: "x402" and an x402_proof object with a txHash.
POST /api/agent/execute
Response: 402 Payment Required
{
"error": "Payment Required",
"code": 402,
"message": "X-AGNTOR-Proof header required for agent transaction",
"payment_context": {
"required_proof": "X-AGNTOR-Proof",
"issuer_endpoint": "https://agntor.com/issue-ticket",
"documentation": "https://agntor.com/x402-handshake"
}
}
POST /api/agent/execute
X-AGNTOR-Proof: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Content-Type: application/json
{
"amount": 25.0,
"mcp_server": "finance-node"
}
Middleware Action:
max_op_value constraintallowed_mcp_servers whitelistreq.agntor with agent infoRequest continues to handler with:
req.agntor = {
ticket: { /* full payload */ },
agentId: "agent-12345",
auditLevel: "Gold"
}
Response: 403 Forbidden
{
"error": "Forbidden",
"code": 403,
"message": "Agent certification validation failed",
"reason": "Ticket has expired",
"error_code": "EXPIRED"
}
app.use('/api', createTrustProxy({
issuer,
onError: (error, req, res) => {
// Log to monitoring system
console.error('Trust violation:', error);
// Custom response
res.status(error.statusCode).json({
error: error.message,
agent_id: req.headers['x-agent-id'],
timestamp: new Date().toISOString(),
});
},
}));
app.use('/api', createTrustProxy({
issuer,
onSuccess: (result, req) => {
metrics.increment('agntor.validations.success', {
audit_level: result.payload!.audit_level,
agent_id: result.payload!.sub,
});
},
}));
// Request body structure
{
"transaction": {
"payment": {
"amount": 100.0
}
},
"target": {
"mcp_server": "banking-node"
}
}
// Configure proxy
createTrustProxy({
issuer,
transactionValuePath: 'transaction.payment.amount',
mcpServerPath: 'target.mcp_server',
})
import rateLimit from 'express-rate-limit';
// Apply rate limiter after trust proxy
app.use('/api', createTrustProxy({ issuer }));
app.use('/api', rateLimit({
windowMs: 60 * 60 * 1000, // 1 hour
max: (req) => {
const maxOps = req.agntor?.ticket?.constraints.max_ops_per_hour;
return maxOps || 100;
},
keyGenerator: (req) => req.agntor?.agentId || req.ip,
}));
| Code | Meaning | Status |
|---|---|---|
EXPIRED | Ticket past expiry | 403 |
INVALID_SIGNATURE | Cryptographic failure | 403 |
INVALID_FORMAT | Malformed token | 403 |
KILL_SWITCH | Agent emergency disabled | 403 |
CONSTRAINT_VIOLATION | Transaction exceeds limits | 403 |
VALIDATION_FAILED | Generic validation error | 403 |
INTERNAL_ERROR | System error | 500 |
import { AgntorRequest } from '@agntor/trust-proxy';
app.post('/api/agent/execute', (req: AgntorRequest, res) => {
// Full type safety
const agentId = req.agntor!.agentId;
const constraints = req.agntor!.ticket.constraints;
if (constraints.kill_switch_active) {
// TypeScript knows this field exists
}
});
Designed for high-throughput agent marketplaces.
FAQs
Express middleware for x402 transaction validation with Agntor audit tickets
We found that @agntor/trust-proxy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Product
Socket can now send alerts and supply chain attack notifications to Microsoft Teams, with filters that route the right updates to each channel.

Security News
pnpm 12 rewrites the package manager in Rust, cutting install times by up to 90% while preserving pnpm 11 workflows and lockfiles.

Security News
Socket CTO Ahmad Nassri joins AppSec leaders at Black Hat to discuss active malware, package manager risks, and software supply chain defense.