7.1 KiB
Tabellarius protocol v0 — what crosses the wire, and what the relay learns
Approved 2026-11-08 (Mark) as v0, before any relay code. Every claim below must have a test. A change
is a protocol version bump: documented here with its date and reason, and reviewed in its PR
(CLAUDE.md §2.2, §3).
1. Threat model
| Adversary | Protected | Not protected |
|---|---|---|
| Relay operator (honest but curious, including us) | message content, names, contact lists, which mailboxes belong to the same person by content | IP addresses at connection time and timing — an operator who logs at the network layer can correlate. Reduced by not logging (§5), not prevented. |
| Network observer | content (TLS + MLS) | that a device talks to a relay, and when |
| Stranger | cannot post: no capability token | — |
| Contact who turns hostile | block = rotate the token; their posts are refused | what they already received |
| Stolen phone | database encrypted; key in the OS keystore | an unlocked phone |
| Compromised device | — | everything on it. Out of scope, stated plainly. |
2. Building blocks
- MLS via OpenMLS (licence and Tauri mobile build to verify). One MLS group per pair of people. The Orator fans out into these private groups, so replies stay private.
- Credentials: an Ed25519 key made on the device. The display name travels inside MLS messages only.
3. Mailboxes and tokens
- A client creates one mailbox per contact (random 128-bit id), so the relay cannot tell by addressing that two conversations involve the same person.
- Each mailbox has a post token (random 256-bit) given only to that contact, and a fetch token kept by the owner. The relay stores hashes of both.
- Block = the owner rotates the post token; the old one is refused. The blocked person is not told.
4. Invitations
A QR code (in person) or a link carries: relay URL, an invite id, and a one-time secret. Unclaimed invites expire after 7 days (decided 2026-11-08).
- The inviter leaves its MLS KeyPackage on the relay under the invite id and the secret's hash.
It also creates a welcome mailbox, whose id and post token are derived from the secret with
HKDF-SHA256: empty salt, info
tabellarius v0 welcome mailbox(16 bytes) andtabellarius v0 welcome mailbox post(32 bytes). - The invitee claims the KeyPackage with the secret, which deletes the invite. It creates the
MLS group with the inviter in it, and posts to the welcome mailbox:
- the Welcome;
- an MLS message carrying its own mailbox id, a post token for it, and its name.
- The inviter joins from the Welcome and answers inside MLS with its own mailbox, post token and name.
From then on each side posts to the other's mailbox. Names and post tokens travel only inside MLS. To the relay, the welcome mailbox is an ordinary mailbox. (Changed 2026-11-14, approved by Mark, from "the invitee replies with their own KeyPackage": the invitee needs no KeyPackage, because it creates the group itself.)
5. What the relay stores — the complete list
| Table | Columns |
|---|---|
mailboxes |
id, hash(post token), hash(fetch token), created day |
blobs |
mailbox id, ciphertext, size, received hour (rounded) |
invites |
invite id, hash(fetch secret), KeyPackage, expiry |
push (only if the user opts in, G03) |
mailbox id, push endpoint |
Nothing else. No IP, no user agent, no request log beyond counts. A blob is deleted on acknowledged delivery and after 30 days at the latest (decided 2026-11-08). The reverse proxy in front must also not log; the NixOS module ships configured that way.
6. Waking a closed app
A notification for a closed app needs a push service. The wake-up carries no content and no sender — only "something arrived".
- Android: UnifiedPush lets the user choose their own distributor; FCM as a fallback.
- iOS: only the app's publisher can send through Apple's push service, so a self-hosted relay
cannot wake an iOS app directly. It would go through a small push gateway run by the publisher,
which learns a device token and timing.
Decided: iOS uses a small push gateway run by the publisher, carrying no content and no sender.
It learns a device token and timing, and users are told so plainly in How your messages travel.
The platform facts above are Claude's understanding, to be verified in
.agents/features/wake-up.md.
7. Tests that prove this document
- A canary string sent in a message never appears anywhere in the relay's database or logs.
- A post without a valid token is refused; after rotation the old token is refused.
- A delivered blob is gone; an undelivered blob is gone after the TTL (clock injected).
- Parsers are fuzzed (
cargo fuzz) for every message type. - Every check in
VERIFY.md§1 has a CI job or a documented manual procedure.
8. The wire (v0) — approved 2026-11-08, routes added 2026-11-14, quotas 2026-11-16
HTTP/1.1 behind TLS (the reverse proxy, F23). Ids and tokens are unpadded base64url of a fixed length with one canonical spelling: ids are 16 bytes, and tokens and hashes are 32. JSON bodies refuse unknown fields. A blob is at most 256 KiB, and a KeyPackage at most 16 KiB.
| Method and path | Auth (Authorization: Bearer) |
Effect |
|---|---|---|
POST /v0/mailboxes {id, postTokenHash, fetchTokenHash} |
none | creates a mailbox. The owner sends hashes, so the relay never holds a token |
POST /v0/mailboxes/{id}/blobs (bytes) |
post token | stores the blob with its size and the hour it arrived |
GET /v0/mailboxes/{id}/blobs |
fetch token | the waiting blobs, oldest first, at most 100. Fetching deletes nothing |
DELETE /v0/mailboxes/{id}/blobs/{sha256} |
fetch token | acknowledges: deletes that mailbox's blob with this SHA-256. §5 has no blob id, and a sequential id would leak how busy the relay is |
PUT /v0/mailboxes/{id}/post-token {postTokenHash} |
fetch token | blocks: the old post token is refused from now on |
POST /v0/invites {id, secretHash, keyPackage} |
none | stores an invite. It expires after 7 days, rounded up to the hour |
GET /v0/invites/{id} |
invite secret | returns the KeyPackage once, then deletes the invite |
GET /version |
none | the protocol and relay versions |
- A wrong token, an unknown id and a malformed id all give the same bare 404, so nobody can probe what exists.
- Quotas (added 2026-11-16, F23, so a relay can face the internet;
.agents/features/home-relay.md): a mailbox holds at most 1 000 waiting blobs and 32 MiB, and a relay at most what its operator sets (by default 1 GiB of blobs, 100 000 mailboxes, 10 000 unclaimed invites). Over a limit the answer is a bare 507. The per-mailbox caps are checked only after the post token, so a 507 tells a stranger nothing about a mailbox. Nothing new is stored to count: the counts come from §5's own rows andsize. A client treats 507 like any failure and tries again later. - A refusal has no body.
- The relay prints no request.
- Tests:
crates/relay/tests/relay.rs,crates/protocol/tests/wire.rs.