Skip to main content
The proxy is what keeps the browser from ever seeing the Gateway token: the SPA opens a WebSocket to the same origin, and the proxy fills in auth.token and a device signature on the connect frame before forwarding upstream. The device identity is a persistent keypair on disk (~/.clawboo/proxy-device-identity.json), so preview / incognito / fresh-machine browser contexts all connect without managing their own keys. Its device-auth primitives are also re-used by the server-side AgentSource connection (a non-browser GatewayClient) via the gateway-client signConnect hook.

Public API

Functions

Types & interfaces

The barrel exposes no classes or runtime constants. WebSocketServer surfaces only as a field type on GatewayProxyHandle.wss (re-exported from ws, not from this package). The keepalive interval and frame-cap are config options on ProxyOptions, not exported constants.

Used by

  • apps/web/server/index.ts, boots the proxy (createGatewayProxy) for the /api/gateway/ws upgrade and the createAccessGate for HTTP/WS authorization.
  • apps/web/server/lib/agentSource/registry.ts, re-uses loadOrCreateProxyDeviceIdentity + signConnectParams (+ the DeviceIdentity type) so the server-side OpenClawAgentSource’s non-browser GatewayClient signs its own connect frames with the already-paired proxy identity.
  • apps/web/server/lib/bootProbe.ts, calls getProxyDeviceIdentityPath to check the vault/identity file location during the boot health probe.

Source

Barrel: packages/gateway-proxy/src/index.ts. Implementation: proxy.ts (the WS proxy + token/device injection + keepalive), access-gate.ts (the token-cookie gate), proxy-device-auth.ts (Ed25519 identity load/generate + connect-frame signing).

See also

Last modified on June 26, 2026