Zero Trust Security Guide¶
Antimatter securely connects your mobile device to your local machine without opening any firewall ports or exposing your local IP address. It achieves this using Cloudflare Zero Trust (via cloudflared).
Two methods
- TryCloudflare (free, automatic) — the extension handles everything. No domain needed.
- Cloudflare Zero Trust (recommended) — persistent hostname + Access policies. Requires a domain.
How the Tunnel Works¶
┌──────────────┐ outbound ┌──────────────────┐ WSS ┌──────────────┐
│ VS Code │ ──────────────────▶│ Cloudflare Edge │◀────────────── │ Android App │
│ Extension │ cloudflared conn │ (TLS termination│ Bearer token │ (Client) │
│ :8765 │ │ + routing) │ + Ed25519 │ │
└──────────────┘ └──────────────────┘ └──────────────┘
- The extension starts a WebSocket server on
127.0.0.1:8765. - It downloads (if missing) and launches
cloudflaredin the background. cloudflaredcreates an outbound connection to Cloudflare's edge — no inbound ports needed.- Cloudflare assigns a public URL (e.g.
wss://funny-words.trycloudflare.com). - The Android app connects to this URL; Cloudflare routes traffic back through the tunnel.
Double-Layered Protection¶
Even if someone discovers your tunnel URL, they cannot connect:
| Layer | Where | What happens |
|---|---|---|
| Cloudflare Access (optional) | Edge | Blocked before traffic reaches your machine. Requires OAuth/SAML identity or service auth headers. |
| 256-bit Pairing Token | Local | Timing-safe comparison. Invalid token → close 4001. |
| Ed25519 Handshake | Local | Bridge signs a client nonce, proving its identity. Prevents MITM even if the tunnel is compromised. |
Automatic Quick Tunnel (TryCloudflare)¶
This is the default — zero configuration required.
When the bridge starts and antimatter.cloudflareHostname is blank:
- The extension downloads
cloudflaredif it's not inPATH. - Spawns:
cloudflared tunnel --url localhost:8765 - Parses the assigned URL from
cloudflaredoutput. - Embeds the URL + pairing token + public key into the QR code.
Nothing to configure
Just install the extension, scan the QR, and go.
Ephemeral URL
The URL changes every time cloudflared restarts. Re-scan the QR code after restarting the bridge or your machine.
Manual Cloudflare Zero Trust Setup¶
For a persistent, enterprise-grade setup with your own domain.
Install cloudflared¶
Download from the official Cloudflare downloads page.
Download the .msi from the releases page and run the installer.
Authenticate¶
This opens a browser to authenticate with your Cloudflare account and stores a certificate locally.
Create a Tunnel¶
Note the tunnel UUID that's printed — you'll need it for routing.
Route Your Domain¶
Point your custom domain (e.g. ide.yourdomain.com) to the tunnel:
Configure cloudflared¶
Create ~/.cloudflared/config.yml:
tunnel: <YOUR_TUNNEL_UUID>
credentials-file: ~/.cloudflared/<YOUR_TUNNEL_UUID>.json
ingress:
- hostname: ide.yourdomain.com
service: ws://localhost:8765
- service: http_status:404
Start the tunnel:
Add Cloudflare Access (Enterprise Security)¶
For the ultimate setup, protect the route with an Access Application:
- In the Cloudflare Zero Trust Dashboard, go to Access → Applications → Add an application.
- Create a Self-hosted app matching
ide.yourdomain.com. - Add an Access Policy (e.g. allow your email domain, or specific users).
- Generate a Service Auth Client ID and Client Secret.
This creates the double-layered protection:
- Layer 1 (Edge): Attackers are blocked at Cloudflare — they lack the Service Auth headers.
- Layer 2 (Local): Even if an attacker somehow bypasses the edge, the extension rejects them without the 256-bit token and Ed25519 handshake.
Configure the Extension¶
- Open VS Code Settings and search for "Antimatter".
- Set
antimatter.cloudflareHostnameto your hostname (e.g.ide.yourdomain.com). - Run
Antimatter: Set Cloudflare Credentialsfrom the Command Palette. - Enter your Client ID and Client Secret (stored securely in your OS keychain).
The extension now uses your persistent tunnel instead of spawning a Quick Tunnel.
Configure the Android App¶
- Open the Antimatter app on your phone.
- On the Connect screen, tap Advanced Options.
- Enter your custom URL:
wss://ide.yourdomain.com - Enter your Client ID and Client Secret.
- Tap Connect (or scan the QR code, which now embeds your hostname).
FAQ¶
Can I use a different tunnel provider?
Antimatter is designed around Cloudflare. Other providers (ngrok, localtunnel, etc.) may work if they support WebSocket proxying, but they are not officially supported and may not provide the same security guarantees.
Do I need Cloudflare Zero Trust to use Antimatter?
No. The free TryCloudflare Quick Tunnel works out of the box with zero configuration. Zero Trust is recommended for persistent setups and teams.
What if my tunnel URL changes?
Quick Tunnel URLs change on restart — re-scan the QR code. Zero Trust tunnels with a custom domain are persistent.
Related¶
- Security Policy — all security mechanisms in detail
- WebSocket Protocol — auth flow, close codes, and full message contract
- Installation & Setup — quick-start guide