A sample Node.js Express server demonstrating RFC 9421 HTTP Message Signature verification for the Trusted Agent Protocol (TAP).
Create a .env file in the root directory:
# Server Configuration
PORT=3001
# Upstream Services
MERCHANT_BACKEND_URL=http://localhost:8000
AGENT_REGISTRY_URL=http://localhost:8081
# Debug Configuration
DEBUG=true- 🔐 RFC 9421 Signature Verification: Validates HTTP Message Signatures
- 🎭 Multi-Algorithm Support: Ed25519 and RSA-PSS-SHA256 algorithms
- 🌐 Request Proxying: Routes verified requests to merchant backend
- 🔑 Dynamic Key Retrieval: Fetches public keys from Agent Registry
- 📊 Request Logging: Detailed logging for debugging
- 🛡️ Security Demo: Shows secure error handling patterns
# Install dependencies
npm install
# Start the server
npm startThe CDN Proxy will be available at http://localhost:3001
Note: Requires Agent Registry (port 8080) and Merchant Backend (port 8000) to be running
- Receives Request: Client sends request with RFC 9421 signature headers
- Extracts Signature: Parses
Signature-InputandSignatureheaders - Fetches Key: Retrieves public key from Agent Registry using
keyId - Verifies Signature: Validates signature using Ed25519 or RSA-PSS-SHA256
- Proxies Request: Forwards verified requests to Merchant Backend
GET /products/1→ Forwards tohttp://localhost:8000/products/1POST /cart/add→ Forwards tohttp://localhost:8000/cart/add(requires signature)GET /orders→ Forwards tohttp://localhost:8000/orders(requires signature)
curl -X GET http://localhost:3001/products/1 \
-H "Signature-Input: sig2=(\"@authority\" \"@path\"); created=1697123456; keyId=\"primary-ed25519\"; alg=\"ed25519\"" \
-H "Signature: sig2=:base64EncodedSignature:"- Ed25519: Fast elliptic curve signatures
- RSA-PSS-SHA256: Traditional RSA with PSS padding
Implements HTTP Message Signatures with components:
@authority- Host header@path- Request pathcreated- Signature creation timekeyId- Key identifieralg- Signature algorithm
Signature-Input: sig2=("@authority" "@path"); created=1697123456; keyId="primary-ed25519"; alg="ed25519"
Signature: sig2=:base64EncodedSignature:# Auto-reload for development
npm run dev
# Enable debug logging
DEBUG=true npm startThis is a sample implementation showing how to:
- Parse RFC 9421 signature headers
- Retrieve public keys from a registry
- Verify signatures with multiple algorithms
- Proxy requests based on verification results