[docs] F20: PROTOCOL.md section 8, the v0 routes — approved by Mark 2026-11-14

This commit is contained in:
2026-11-14 13:06:56 +01:00
parent 710e1f87fb
commit 841236dc87
+22
View File
@@ -61,3 +61,25 @@ The platform facts above are Claude's understanding, to be verified in `.agents/
- 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
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.
- A refusal has no body.
- The relay prints no request.
- Tests: `crates/relay/tests/relay.rs`, `crates/protocol/tests/wire.rs`.