Skip to main content
← All blueprints
Difficulty: advanced
[SEEKING COLLABORATORS]WebRTCRustCrypto

Zero-Knowledge P2P Clipboard Relay

An end-to-end encrypted, ephemeral peer-to-peer clipboard sync protocol over WebRTC DataChannels with a minimal blind signaling relay.

Problem Statement

Copying a token, snippet, or URL between a workstation and a phone usually means routing plaintext through third-party cloud clipboards, chat apps, or proprietary ecosystem locks. Even when transport uses TLS, the relay server typically inspects or persists clipboard payloads.

The goal of this blueprint is a zero-knowledge, ephemeral clipboard relay where devices pair via a short-lived QR/SAS code, exchange encrypted payloads directly over WebRTC DataChannels, and leave zero readable state on any intermediary server.

Proposed Architecture

  1. Identity & Pairing: Each device generates an ephemeral X25519 keypair in memory. Scanning a QR code transfers the peer's public key fingerprint and a 128-bit room token.
  2. Blind Signaling Server (Rust): A lightweight WebSocket relay forwards SDP offers/answers and ICE candidates indexed only by H(roomToken)—never seeing plaintext payloads or identity keys.
  3. Encrypted DataChannel: Once the WebRTC RTCDataChannel opens, peers derive a symmetric session key via HKDF-SHA256 from the X25519 shared secret and encrypt every clipboard chunk using XChaCha20-Poly1305 with a monotonic counter nonce.
  4. TTL & Memory Hygiene: Clipboard entries automatically expire after 90 seconds in client memory, and closing the tab zeroizes key buffers.
text
[Device A] --(X25519 + SDP over WSS)--> [Blind Rust Relay] <--(SDP + ICE)-- [Device B]
     |                                                                          |
     +================ Direct WebRTC DataChannel (XChaCha20-Poly1305) =========+

Trade-Offs & Where I Got Stuck

  • Symmetric NAT Traversal: Pure P2P works cleanly on home Wi-Fi, but mobile carrier NATs frequently drop direct UDP hole-punching. Falling back to a TURN server breaks the "zero infrastructure cost" constraint unless TURN credentials are rate-limited and bandwidth-capped.
  • Browser Background Suspension: On iOS Safari and Android Chrome, backgrounding a tab throttles or tears down the RTCPeerConnection within ~30 seconds, forcing a fast reconnect handshake when the user switches back to paste.
  • OS Clipboard Permission Friction: Modern browsers gate navigator.clipboard.readText() behind active user gestures, making silent background sync impossible without a companion desktop/mobile daemon.

Open Questions

  • Should mobile support rely purely on a PWA with explicit tap-to-receive, or a tiny Rust tray/CLI companion for seamless OS clipboard hooks?
  • What is the cleanest replay-protection window if out-of-order unreliable DataChannel messages are enabled for large payloads vs. strict ordered delivery?
  • Can WebAuthn PRF extensions bind long-lived trusted device pairs without storing raw private keys in IndexedDB?

Open Collaboration

Want to collaborate or build this spec? Let's talk

Have a better approach for the stuck points or want to co-build a prototype? Reach out directly with notes or questions.