feat(outbox): local retry queue for chat sends
All checks were successful
ci / test (pull_request) Successful in 3m21s
All checks were successful
ci / test (pull_request) Successful in 3m21s
Queue a chat send locally when the peer's v3 onion is unreachable and retry it with exponential backoff (30s doubling, capped at 30 min, 8 attempts then terminal Failed). Still peer-to-peer: no server, no store-and-forward relay, no new frame prefix — every attempt is a fresh Noise IK handshake. - src/outbox.rs: Outbox + Deliverer + ArtiDeliverer, pure backoff_secs(), is_permanent_send_error(), background worker (15s scan). - store: `outbox` table (no body column — the body is read from the joined messages row, under that row's existing AEAD + AAD), append_message_id(), queue/due/pending/mark_* helpers, reset_sending_outbox(), wipe. - Node::send() returns Result<OutboxStatus, String> (Sent/Queued) instead of Err on transport failure; protocol errors still fail immediately and are never queued. - Retry triggers: timer, unlock/foreground (spawn_flush_all), and "that peer was just seen" (handshake or connect_onion -> spawn_flush_friend). - File transfer and payment/rcp frames stay fail-closed. - docs/PROTOCOL.md + docs/THREAT_MODEL.md: replace the no-queue statements; add the seizure/cadence delta to the threat model. src/tui.rs gets one forced arm change (Ok(()) -> Ok(_)); UI surfacing is child card t_d9a5b065.
This commit is contained in:
parent
2b2ad573c0
commit
ad59a171b3
9 changed files with 1042 additions and 53 deletions
|
|
@ -19,7 +19,7 @@ SOCKS proxy.”
|
|||
| Discovery | DHT + bootstrap nodes | Out-of-band invite only |
|
||||
| After lookup | Direct IP or TCP relay (SOCKS if you forced it) | v3 onion ↔ v3 onion |
|
||||
| Address | Tox ID lives in the DHT | ed25519 pubkey is identity; onion is a locator |
|
||||
| Offline send | Expected (relays / retry) | Fail closed — no outbox |
|
||||
| Offline send | Expected (relays / retry) | Queued locally, retried peer-to-peer (no relay) |
|
||||
| Mixed clearnet | ToT can still talk to non-Tor Tox | No clearnet peers |
|
||||
|
||||
There is no directory, no name server, no introduction point of our own, and no
|
||||
|
|
@ -51,8 +51,18 @@ not on the wire.
|
|||
4. File transfer is N independent sessions (one handshake per chunk). There is
|
||||
no multiplexed long-lived stream in v1.
|
||||
|
||||
If the onion is down, send fails. No retry queue except the locator-push path,
|
||||
which retries for 180 seconds and then gives up.
|
||||
If the onion is down, a **chat** send is persisted to the local outbox and
|
||||
retried by a background worker with exponential backoff (30s, doubling, capped
|
||||
at 30 min; 8 attempts, then terminal `Failed`). There is no server and no
|
||||
store-and-forward relay: each attempt is a fresh handshake straight to
|
||||
`(friend.onion, 80)`, exactly as above. Retries fire on a timer, on
|
||||
unlock/foreground, and whenever that peer is heard from (successful handshake or
|
||||
`connect_onion()`). A protocol failure — signature mismatch, unknown frame,
|
||||
oversize — is not a transport failure and is never queued.
|
||||
|
||||
File transfer and payment frames stay fail-closed: they are one-shot and are
|
||||
**not** queued. The locator-push path still retries for 180 seconds and then
|
||||
gives up.
|
||||
|
||||
Incoming rendezvous accepts are token-bucket limited: 30 per 60s, burst 10.
|
||||
Excess is dropped before handshake. That is availability, not anonymity.
|
||||
|
|
|
|||
|
|
@ -24,7 +24,16 @@ Identity secret key, friend public keys, and locators remain plaintext in the sa
|
|||
|
||||
## Fail closed
|
||||
|
||||
Peer onion down → send fails. Fingerprint mismatch vs the pinned key → hard fail, no send. Arti HS experimental: if it cannot publish, OnionWire stops; it does not fall back to C-tor.
|
||||
Peer onion down → a **chat** send is queued locally and retried (see “Local outbox (chat retry queue)”); file transfer and payment frames still fail immediately. Fingerprint mismatch vs the pinned key → hard fail, no send, never queued. Arti HS experimental: if it cannot publish, OnionWire stops; it does not fall back to C-tor.
|
||||
|
||||
## Local outbox (chat retry queue) is local, and it re-dials on a schedule
|
||||
|
||||
A chat send to an unreachable onion is written to an `outbox` row next to its `messages` row and retried in the background. There is no server-side queue: a queued message is never handed to a third party, and it dies with the device. Two consequences are real and are accepted:
|
||||
|
||||
- **Device seizure.** A pending (never-delivered) message sits in the same db as the rest of the history, under the same per-row AEAD and the same passphrase-derived key — no weaker, but also no shorter-lived. Seizure with the passphrase reveals messages that were never actually sent, including ones the sender may have moved on from. `/wipe` clears outbox rows with the rest of chat history; `/wipe-all` removes them with the data dir. Neither is a forensic erase.
|
||||
- **Retry cadence is a local traffic-analysis surface.** A queued send re-dials the peer's onion on a backoff schedule while the app runs. An observer of your Tor client (or the network in front of it) sees a repeating connection attempt to one onion on a predictable cadence — it does not learn the plaintext or the recipient identity, but it can infer that you have an undelivered message for someone, and roughly when you composed it. The backoff is per-row, capped at one attempt per 30 min per message, and stops after 8 attempts or on a terminal failure.
|
||||
|
||||
The queue is bounded in scope: chat only. File transfer and `rcp` frames are one-shot, so a failed payment claim does not sit in the store being retried forever.
|
||||
|
||||
## Profile is friend-visible, not a directory
|
||||
|
||||
|
|
@ -65,5 +74,7 @@ the peer already knows the plaintext they sent.
|
|||
|
||||
## Out of v1
|
||||
|
||||
Prosody, XMPP, s2s, MAM, carbons, outbox, multi-device, DHT / name server,
|
||||
sqlcipher, A/V.
|
||||
Prosody, XMPP, s2s, MAM, carbons, a **server-side** outbox / store-and-forward
|
||||
relay, multi-device, DHT / name server, sqlcipher, A/V. The local retry queue of
|
||||
the previous section is not an outbox in the XMPP sense: it never leaves the
|
||||
device.
|
||||
|
|
|
|||
Loading…
Reference in a new issue