Open protocol · v1 draft

Two apps. One room.
Nothing for the relay to read.

PeerConnect pairs two applications — a phone and a laptop, a web app and a wallet, two services on different networks — through a WebSocket relay that can’t read, forge or replay what they say, and that stores nothing.

  • 6 frame types
  • 1 handshake
  • 0 bytes stored on the relay
The relay forwards ciphertext between the two seats of a room. It never holds a key.
Why PeerConnect

A small protocol that does one thing well

A private, reliable channel between exactly two peers. No accounts, no message store, no trust in the server in the middle.

Untrusted relay

Every message is encrypted and authenticated end to end, keyed by a Noise IKpsk1 handshake. The relay sees sizes and timing — never contents, keys or identities.

Stateless by design

No database, no accounts. A room exists on a relay only while someone is connected; the relay can restart, or be replaced by another, and peers simply reconnect.

Reliable, in order, exactly once

Messages are numbered, acknowledged and resent after any disconnection. Send while the other side is away; it arrives when it comes back. The sender is the queue.

Invites that expire

After first contact, both peers move to a room ID derived from their two identities. A leaked QR code or link leads nowhere.

Any language

An open specification with test vectors: implement a peer in any language, or have your AI agent do it from llms.txt. The Rust and JavaScript implementations in the repository are there to read.

Specified and tested

A short written specification; test vectors reproduced by an independent implementation; deterministic simulations and chaos tests that cut, replay and tamper with traffic.

How it works

From a QR code to a lasting channel

Four steps. The relay takes part in none of the secrets.

  1. 01

    Create a room

    The inviter draws a random 32-byte room secret. From it come the room’s ID on the relay — an Ed25519 public key — and a pre-shared key for the handshake.

    Room.create(relay)
  2. 02

    Hand over the invite

    The invite is the relay URL, the secret and the inviter’s public key. Show it as a QR code, send a link, paste it — any private channel will do.

    wss://relay…#secret‖key
  3. 03

    Pair

    The joiner proves to the relay that it holds the room key without revealing it, then runs the Noise handshake. The inviter pins its identity, and both move to a pair ID only they can compute.

    invite ID → pair ID
  4. 04

    Talk, for good

    Messages flow both ways, encrypted with ChaCha20-Poly1305. Networks drop, relays restart, laptops sleep: peers reconnect, handshake again and resume exactly where they stopped.

    reconnect · resume · exactly once
API

An API, a protocol and llms.txt

Get tokens over HTTP, implement the open protocol in any language, or hand the specification to your AI agent.

No SDK to install: see Get access, the API reference and llms.txt.

shell
# Try it: a trial token, no account (two hours)
curl -X POST https://peerconnect.dev/api/trial
# → {"token": "eyJ…", "expires_at": …, "relay_url": "wss://relay.peerconnect.dev"}

# Your app’s server: a token per user of yours, with the app secret
curl https://peerconnect.dev/api/apps/app_…/tokens \
  -H "authorization: Bearer $PEERCONNECT_APP_SECRET" \
  -H "content-type: application/json" \
  -d '{"user": "user-42"}'

# Then each peer connects with its own token
#   wss://relay.peerconnect.dev/v1/<room id>?token=<token>
Self-hosting

Run your own relay

Nothing to configure, nothing to back up. The relay forwards frames between two seats and forgets them.

Cloudflare Workers

One Durable Object per room with WebSocket Hibernation: idle rooms cost nothing, and it runs on Cloudflare’s network.

Docker

A static binary in an empty image. Put it behind any TLS proxy, or use the bundled Caddy setup for automatic HTTPS.

Single binary

One command: cargo install peerconnect-relay. Four environment variables, connection limits per client address included.

Just experimenting? Use the public relay wss://relay.peerconnect.dev — the one the demo uses. It is for testing, with no uptime guarantee.

Deployment guide
Security

What the relay can and cannot see

The relay learns

  • Room IDs, and when they are in use
  • Network addresses and connection times
  • Frame sizes and timing

The relay never learns

  • Message contents
  • Identity keys or the room secret
  • Which rooms belong to the same person, when each room uses its own identities

Status: the v1 specification is a draft for review, and the code has not had an external audit. Build on it, test it, try to break it — but do not protect high-value assets with it yet.

Known limitations →
Use cases

Made for two

Wallet ↔ web app

Approve on your phone what a site on your laptop asks for, through a relay that cannot see what you signed.

Phone ↔ desktop

Pair a mobile app with a desktop app once; sync, control or share whenever both are online.

Device to device

Move files, clipboard or settings between your own devices, without an account or a copy in the cloud.

You ↔ your service

Reach a service or agent behind NAT from your phone, without opening ports or trusting a broker.

FAQ

Questions

Can the relay read or change my messages?

No. Messages are encrypted and authenticated with keys only the two peers hold. A relay can drop, delay or cut connections — peers notice and recover — but it cannot read, forge, replay or reorder messages without being detected.

How is this different from WebRTC?

WebRTC connects peers directly, for real-time media, and needs a signaling server plus STUN/TURN to get there. PeerConnect always goes through a relay over plain WebSockets, so it works wherever the web does, and it adds what WebRTC leaves to you: pairing, persistent identities and reliable delivery across reconnections.

How is it different from WalletConnect?

WalletConnect is an ecosystem built around crypto wallets and its own network. PeerConnect is a small, general-purpose transport: any two apps, any payload, and a stateless relay you can run yourself in minutes.

What if the other side is offline?

Send anyway. The sender keeps each message until the other side acknowledges it, and delivers it as soon as both are connected at the same time. The relay stores nothing, so an app that quits before then should keep its own copy of what it has not seen delivered.

What happens when the relay restarts?

Nothing you need to handle. Rooms are not stored on the relay: peers reconnect, authenticate again and resume the stream without losing or duplicating a message.

Is it ready for production?

Not yet. The protocol is a v1 draft, extensively tested but not externally audited, and the wire format may still change. It is ready for prototypes and feedback.

See it work in your browser

Open the demo on two devices, scan the QR code, send a message. The encryption runs on your devices; the relay only ever forwards ciphertext.

Open the live demo