Protocol v1, auth and the limits
The wire contract between every Yap client and both server backends, plus what a session is made of and the ceilings the protocol enforces. This is the normative summary; docs/protocol.md carries the full endpoint list.
1. Protocol v1
Two channels to the server, both over TLS in production (plain HTTP is accepted by the client only for loopback):
- REST (
/api/v1/...): JSON. Auth, spaces, invites, history, uploads, bots, API keys. - Gateway (
/gateway): WebSocket, one binary message = one protobufFrame(server/proto/proto/yap/v1/gateway.proto). There is no resume; after a reconnect the client refetches what it shows. - Passive gateway:
Hello.passiveopens a notification-only connection. It receives events but is not presence, cannot post, and is not a voice hand-off target;Ready.capabilitiesbit 0 advertises support. See docs/protocol.md.
IDs are 63-bit and time-ordered: 41 bits of milliseconds since 2026-01-01, 22 bits of sequence. In JSON they are strings, because they exceed 253; in protobuf they are fixed64.
Full endpoint list: docs/protocol.md in the repository.
2. Auth and sessions
- The password never leaves the device. The client sends a login key:
base64url(argon2id(password, salt)), m=19 MiB, t=2, p=1, 32-byte output, withsalt = SHA-256("yap/v1/login\0" + lowercase(host) + "\0" + lowercase(username))[..16]. Servers hash the key again — argon2id on the self-hosted server, HMAC-SHA256 with a secret pepper on the Worker. The browser derives the same key in WebAssembly. - Tokens are 256-bit random, base64url; the server stores only SHA-256 hashes. Access token: 10 minutes. Refresh token: 30 days, single use, rotated; presenting an already-rotated refresh token revokes every token in that session family.
- Every sign-in also sends a random
proof_key. Every later use of that session signs with it:X-Yap-Proofon REST,proofin the refresh body,Hello.proofon the gateway. A token copied out of a client, a log or a screenshot is inert on its own — turning it into a working session needs the password or login key. - API keys (
yap_…, REST only) and bot tokens (yapbot_…, REST and gateway) are long-lived credentials of their own and carry no proof. - Username: 2–32 of
A-Z a-z 0-9 . _ -. Password: 10–256 characters, enforced client-side.
3. Sign-up cap and address tags
Two accounts per IP address; the third registration from one address is 409 with "Two accounts per address is the limit." The cap is --max-accounts-per-ip N on a self-hosted server (0 lifts it) and the MAX_ACCOUNTS_PER_IP var on the Worker. Logins are never capped.
The address is never stored. Each sign-up bumps a counter in signup_tags, keyed by hex(HMAC-SHA256(K, "yap/v1/signup\0" + address)[..16]). The table has no user id, no timestamp and no row order, so a tag cannot be tied to an account. On the Worker K is PEPPER; self-hosted it is a random key in <database file>.signup-key (or YAP_SIGNUP_KEY_FILE), created on first start and kept outside the database. Losing K only resets the cap. Rate-limit buckets stay in memory only.
Updated . Yap technical documentation is part of the documentation index; the product itself is at getyap.dev.