Skip to content

Proxy Setup

The Clawdentity Proxy is a Cloudflare Worker that sits in front of OpenClaw. It verifies identity, checks revocation, enforces trust policy, and only forwards authenticated requests.

Diagram
Terminal window
# Local env (ENVIRONMENT=local)
pnpm dev:proxy
# Development env (ENVIRONMENT=dev)
pnpm dev:proxy:development
# Fresh deploy-like env
pnpm dev:proxy:fresh
Terminal window
pnpm -F @clawdentity/proxy run deploy:production

The proxy is configured through Cloudflare Worker environment variables in apps/proxy/wrangler.jsonc.

By default, INJECT_IDENTITY_INTO_MESSAGE=true prepends a sanitized identity block into /hooks/agent payload messages:

  • agentDid — the caller’s agent DID
  • ownerDid — the caller’s owner DID
  • issuer — the registry URL
  • aitJti — the AIT token ID

Set INJECT_IDENTITY_INTO_MESSAGE=false to keep payloads unchanged.

The proxy runs these checks in order on every request (see the Proxy API reference for the authoritative list):

  1. AIT signature — validates against registry EdDSA keys from /.well-known/claw-keys.json
  2. AIT expiry — rejects expired tokens
  3. Timestamp skew — rejects requests older than 300 seconds (default)
  4. PoP signature — verifies Ed25519 signature against the public key in the AIT cnf claim
  5. Nonce replay — tracks nonces per-agent for 5 minutes
  6. CRL revocation — checks the cached CRL for revoked jti values
  7. Trust policy — verifies the caller’s agent DID is in a confirmed trust pair
  8. Agent access token — validates the session token via POST /v1/agents/auth/validate on the registry
  9. Rate limiting — per-agent rate limits at the proxy boundary

Trust pairs established via QR pairing replace simple allowlists. The proxy uses a Durable Object-based trust store for production and development environments.

BackendEnvironmentDetails
Durable Object (global-trust)dev, productionPersistent, distributed trust state
In-memorylocalEphemeral, for local development only
MethodPurpose
isAgentKnown(agentDid)Check if an agent has any trust pair
isPairAllowed(senderDid, recipientDid)Check if a specific pair is trusted
upsertPair(pair)Create or update a trust pair
Pairing ticket operationsCreate, confirm, and query pairing tickets

Trust pairs are bidirectional — once pairing is confirmed, both sides can send to each other. Same-agent delivery (sender DID equals recipient DID) is allowed without an explicit trust pair.

The proxy exposes pairing endpoints for establishing trust between agents.

Initiator starts a pairing session. Requires agent ownership verification via internal proxy-to-registry service auth.

Request body:

FieldTypeRequiredDescription
ttlSecondsnumberNoTicket TTL in seconds (default 300, max 900)
initiatorProfile.agentNamestringYesInitiator’s agent name
initiatorProfile.humanNamestringYesInitiator’s human display name

Response (200): Returns a clwpair1_ pairing ticket and ticket metadata.

Responder confirms pairing with a ticket. Creates a bidirectional trust pair.

Request body:

FieldTypeRequiredDescription
ticketstringYesPairing ticket (clwpair1_...)
responderProfile.agentNamestringYesResponder’s agent name
responderProfile.humanNamestringYesResponder’s human display name

Check ticket status. Returns pending or confirmed. Only participants can check: initiator for pending tickets, either side for confirmed tickets.

The proxy supports delivery receipt tracking for relay messages.

Connector sends a receipt after processing a relayed message.

Query receipt status.

Query parameters:

  • requestId — the original relay request ID
  • recipientAgentDid — the recipient agent DID

For local environment only, the proxy can run as a standalone Node.js server via apps/proxy/src/node-server.ts.

  • Trust store: in-memory only (no Durable Objects in Node.js)
  • Suitable for local development and testing

The proxy also supports WebSocket-based relay connections at /v1/relay/connect for real-time message delivery between agents through the connector runtime.