You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
turn: wire Cloudflare TURN relay via daemon-sole-minter (#6)
STUN-only couldn't connect external testers on cellular/symmetric-NAT/
corporate networks. Add a TURN relay fallback, gated so minting (a billable
resource) only happens for a party we can cryptographically verify.
The signaling worker can prove a daemon's Ed25519 identity but NOT a
client's, so the daemon is the SOLE minter and relays the creds to its
clients over the existing offer:
- signaling worker: POST /turn-credentials verifies a sig over
`turn/v1/<pubkey>/<ts>` (distinct domain tag from the connect sig),
mints from Cloudflare Realtime TURN (12h TTL), guarded by a separate
RL_TURN limiter (10/60s by pubkey). Unset secrets → 503 → STUN fallback.
- daemon: getIceServers() mints+caches (10h TTL, 60s negative-cache,
single-flight, prewarmed in start()), uses the creds for its pc AND
relays the same list in the offer envelope.
- app: handleOffer applies the relayed iceServers via setConfiguration
before createAnswer; the client never mints its own. fpSig still pins
DTLS identity, so a tampering worker can't swap in a hostile relay.
Wire-neutral (offer envelope is worker-forwarded freeform, not a protocol
schema); rollout order-independent (old peers ignore the new field, unset
secrets degrade to STUN). Activate by setting TURN_KEY_ID + TURN_API_TOKEN
secrets, deploying the worker, and shipping daemon (menubar) + app.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments