[relay] Wake-up: a push endpoint per mailbox, and a constant wake to it when a blob arrives
ci / check (pull_request) Has been cancelled
ci / check (pull_request) Has been cancelled
This commit is contained in:
+24
-4
@@ -65,9 +65,11 @@ dropped. **Unblock** rotates again and sends the new token in an `inbox` payload
|
||||
| `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 |
|
||||
| `push` *(only if the user opts in, G03; made concrete 2026-11-20)* | mailbox id, push endpoint |
|
||||
|
||||
Nothing else. No IP, no user agent, no request log beyond counts. A blob is deleted on acknowledged
|
||||
Nothing else. No IP, no user agent, no request log beyond counts. *(2026-11-20:)* the relay also
|
||||
remembers **in memory only**, never on disk, when it last woke each mailbox (§6), to wake it at most
|
||||
once a minute. 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.
|
||||
|
||||
@@ -75,6 +77,17 @@ log; the NixOS module ships configured that way.
|
||||
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.
|
||||
*(Made concrete 2026-11-20, F25b; `.agents/features/wake-up.md`.)* The owner gives the relay one
|
||||
**push endpoint per mailbox** (§8, `PUT …/push`), so the relay cannot link a person's mailboxes by
|
||||
endpoint — it does see the endpoint's **host**, which on a person's own push server links them.
|
||||
When a blob is stored under a valid post token, the relay POSTs the constant body `wake` to the
|
||||
endpoint, at most once a minute per mailbox, with nothing of the mailbox, the blob or its sender.
|
||||
It connects only to **global** addresses (it resolves the host itself and drops loopback,
|
||||
private, link-local, CGNAT, multicast and reserved addresses, IPv4-mapped forms included), follows
|
||||
no redirect, gives up after 10 s, and has at most 16 wakes on their way. A push server's 404 or
|
||||
410 removes the endpoint. The push server learns that the relay woke one of its capability URLs,
|
||||
and when. Not done: Web Push encryption and VAPID (RFC 8291/8292) — the body is a public
|
||||
constant, but a distributor that requires VAPID cannot be used (gap W1).
|
||||
- **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.
|
||||
@@ -86,10 +99,12 @@ The platform facts above are Claude's understanding, to be verified in `.agents/
|
||||
- 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).
|
||||
- A wake carries the constant body and nothing of the mailbox, its tokens or the blob; a mailbox is
|
||||
woken at most once a minute; a non-global address is never connected to (`relay/tests/wake.rs`).
|
||||
- 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, join page 2026-11-18
|
||||
## 8. The wire (v0) — approved 2026-11-08, routes added 2026-11-14, quotas 2026-11-16, join page 2026-11-18, push 2026-11-20
|
||||
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.
|
||||
@@ -101,6 +116,8 @@ unknown fields. A blob is at most 256 KiB, and a KeyPackage at most 16 KiB.
|
||||
| `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 |
|
||||
| `PUT /v0/mailboxes/{id}/push` `{endpoint}` *(2026-11-20)* | fetch token | where to wake the owner (§6): `https://`, a host, no user info or fragment, at most 1 000 bytes. 204 |
|
||||
| `DELETE /v0/mailboxes/{id}/push` *(2026-11-20)* | fetch token | no more wakes for this mailbox. 204, also when none was set |
|
||||
| `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 |
|
||||
@@ -123,4 +140,7 @@ unknown fields. A blob is at most 256 KiB, and a KeyPackage at most 16 KiB.
|
||||
nothing for it and learns only that some address opened the page.
|
||||
- A refusal has no body.
|
||||
- The relay prints no request.
|
||||
- Tests: `crates/relay/tests/relay.rs`, `crates/protocol/tests/wire.rs`.
|
||||
- **Push** *(added 2026-11-20, Amicitia F25b, so a closed Android app hears that something arrived)*:
|
||||
a wrong token or unknown mailbox is §8's bare 404; an endpoint that breaks the rules is 400, and so
|
||||
is `http://` to a loopback host, which only a relay started with `--push-loopback` (tests) accepts.
|
||||
- Tests: `crates/relay/tests/relay.rs`, `crates/relay/tests/wake.rs`, `crates/protocol/tests/wire.rs`.
|
||||
|
||||
Reference in New Issue
Block a user