docs: rewrite README and living docs to match the tree
Audit the operator docs against the source: pin downloads to v0.14.0, document the real CLI/flags/env/F-keys (including F9, no F7), keep 18081 as the app-owned daemon port, describe the local chat outbox vs a server-side one, and stop implying SECURITY_AUDIT.md is a third-party audit. Spike reports stay; they get a status header only.
This commit is contained in:
parent
db12f4838b
commit
f95c1e7ca7
14 changed files with 664 additions and 1649 deletions
|
|
@ -4,7 +4,7 @@ This is the wire protocol. A second implementation should be able to
|
|||
interoperate from this document without reading the Rust.
|
||||
|
||||
It is **not** an IETF RFC. It describes what this repository speaks today
|
||||
(`frame::VERSION` 1, invite scheme `onionwire:v1`). There has been no public
|
||||
(frame version 1, invite scheme `onionwire:v1`). There has been no public
|
||||
third-party audit. Arti onion services are experimental upstream.
|
||||
|
||||
Related: [threat model](THREAT_MODEL.md), [audit notes](SECURITY_AUDIT.md).
|
||||
|
|
@ -46,7 +46,7 @@ not on the wire.
|
|||
## Transport
|
||||
|
||||
1. Each peer publishes a Tor v3 onion service (in-process Arti in this tree).
|
||||
2. Application port is **80** (`HS_PORT`).
|
||||
2. Application port is **80**.
|
||||
3. The sender opens a Tor circuit to `(friend.onion, 80)`, runs the handshake,
|
||||
sends **one** application frame, and drops the circuit.
|
||||
4. File transfer is N independent sessions (one handshake per chunk). There is
|
||||
|
|
@ -58,12 +58,11 @@ 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.
|
||||
a connect to that 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.
|
||||
**not** queued. The locator-push path 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.
|
||||
|
|
@ -99,7 +98,7 @@ from the invite (or roster).
|
|||
|
||||
1. **IK msg 1** — initiator → responder (framed). Responder’s Noise static is
|
||||
the invite `spk`.
|
||||
2. Responder looks up `get_remote_static()` in the roster **by prekey**.
|
||||
2. Responder looks up the remote static in the roster **by prekey**.
|
||||
Unknown prekey → close. This is how the answerer learns who is calling.
|
||||
3. **IK msg 2** — responder → initiator (framed).
|
||||
4. Both sides enter transport mode. Handshake hash `h` is 32 bytes (BLAKE2s).
|
||||
|
|
@ -137,13 +136,14 @@ After decrypt, classify the plaintext:
|
|||
|
||||
| Prefix (4 bytes) | Kind | If unknown / invalid |
|
||||
|---|---|---|
|
||||
| `rat ` | Double Ratchet chat frame (see Ratchet) | drop |
|
||||
| `loc ` | locator update | drop |
|
||||
| `prf ` | profile | drop |
|
||||
| `inv ` | Monero invoice | drop |
|
||||
| `rcp ` | Monero receipt claim | drop |
|
||||
| `png ` | ping (reserved) | drop |
|
||||
| `tip ` | Monero tip (receipt + memo) | drop |
|
||||
| `png ` | ping (reserved; classify and drop) | drop |
|
||||
| `fil ` | file chunk | drop |
|
||||
| `rat ` | Double Ratchet chat frame (see Ratchet) | drop |
|
||||
| `[a-z][a-z][a-z] ` | unknown typed frame | **drop** (not chat) |
|
||||
| anything else | chat | store as a chat line |
|
||||
|
||||
|
|
@ -153,8 +153,7 @@ chat line. Older builds that stored `rat `-prefixed bytes as chat are obsolete;
|
|||
upgrade both sides.
|
||||
|
||||
A peer that does not implement a typed prefix MUST still drop
|
||||
`[a-z]{3}<space>…` rather than render it as chat. Mixed-version 0.1.2 clients
|
||||
that stored those as chat are obsolete; upgrade both sides.
|
||||
`[a-z]{3}<space>…` rather than render it as chat.
|
||||
|
||||
Chat MUST NOT begin with three lowercase ASCII letters and a space. (Inside a
|
||||
`rat ` frame the plaintext is a chat line and is not re-classified.)
|
||||
|
|
@ -170,6 +169,9 @@ form (type tag, then each field, `0x00` separators). Verify MUST accept that
|
|||
form and, for mixed-version peers, the legacy untagged LF-joined layout.
|
||||
Anything else fails closed. Do not emit the legacy layout.
|
||||
|
||||
`tip` is signed over the LF-joined fields only (no domain tag on encode today).
|
||||
The `tip ` prefix is not signed.
|
||||
|
||||
The invite string is separate and keeps `onionwire-invite-v1` (see Invite).
|
||||
|
||||
Older builds verify only the untagged bytes, so they reject tagged signatures
|
||||
|
|
@ -255,7 +257,8 @@ ed25519_sign(identity_sk,
|
|||
accepted on verify. New invoices MUST use the domain-separated form. Do not
|
||||
emit legacy.
|
||||
|
||||
The frame is a signed claim, not a payment.
|
||||
The frame is a signed claim, not a payment. It is one-shot: if the peer onion
|
||||
is down, the send fails. There is no queued invoice.
|
||||
|
||||
### `rcp ` — receipt claim (we paid)
|
||||
|
||||
|
|
@ -279,8 +282,32 @@ emit legacy.
|
|||
Signature proves which friend sent the claim. It does **not** prove money
|
||||
moved. Local `verified=1` only if a user-hosted `monero-wallet-rpc` returns
|
||||
one transfer row with the same non-empty `txid`, `amount`, and `address`
|
||||
(conjunction, not OR). RPC down → stay unverified. Wallet RPC is loopback
|
||||
HTTP Digest; it is not this protocol.
|
||||
(conjunction, not OR). RPC down or an unsynced daemon → stay unverified.
|
||||
Wallet RPC is loopback HTTP Digest; it is not this protocol.
|
||||
|
||||
### `tip ` — tip (we paid, with memo)
|
||||
|
||||
Sent after a chain transfer, together with `rcp `. One-shot.
|
||||
|
||||
```
|
||||
tip <txid>\n<amount_atomic>\n<address>\n<memo>\n<ts>\n<sig_hex>
|
||||
```
|
||||
|
||||
The `tip ` prefix is **not** signed. Encode signs the LF-joined fields:
|
||||
|
||||
```
|
||||
ed25519_sign(identity_sk,
|
||||
txid || LF || amount_atomic || LF || address || LF || memo || LF || ascii(ts))
|
||||
```
|
||||
|
||||
`memo` MUST NOT contain newlines. Same address and amount rules as invoices.
|
||||
A peer that does not implement `tip ` MUST drop it as an unknown typed prefix,
|
||||
not render it as chat.
|
||||
|
||||
### `png ` — ping (reserved)
|
||||
|
||||
Classified as ping and dropped. No ping body is defined in v1. Implementations
|
||||
MUST NOT emit `png ` and MUST drop it inbound.
|
||||
|
||||
### `fil ` — file chunk
|
||||
|
||||
|
|
@ -288,11 +315,10 @@ Cap: 1 MiB reconstructed file. No resume. One Noise session per chunk.
|
|||
|
||||
The sender is responsible for fitting the receiver's documented rendezvous
|
||||
budget (30 accepts / 60s, burst 10). Chunks MUST be paced so the average
|
||||
interval between send attempts stays at least 3s — a margin under the 0.5/s
|
||||
refill; pacing at exactly 2s sits on the refill boundary and drains under
|
||||
jitter. A sender MAY retry an individual chunk a bounded number of times.
|
||||
Exhausting retries fails the transfer. No outbox, no resume, no continuation
|
||||
under a new `xfer_id`.
|
||||
interval between send attempts stays at least 3s. A sender MAY retry an
|
||||
individual chunk a bounded number of times (this tree: 3). Exhausting retries
|
||||
fails the transfer. No outbox, no resume, no continuation under a new
|
||||
`xfer_id`.
|
||||
|
||||
```
|
||||
fil <xfer_id_hex>\n<filename>\n<sha256_hex>\n<idx>/<total>\n<raw bytes>
|
||||
|
|
@ -314,7 +340,7 @@ is a chat line `[file] name (N bytes)`, never the raw frame.
|
|||
A chat send is ratcheted: the wire form of a chat message is a `rat ` frame
|
||||
(see “Ratchet (v1 chat layer)”), and the plaintext inside that frame is the chat
|
||||
line below. A bare chat frame with no typed prefix is still accepted inbound as
|
||||
a chat line (v0.2.1 peers), but MUST NOT be emitted.
|
||||
a chat line (older peers), but MUST NOT be emitted.
|
||||
|
||||
UTF-8 is not enforced for chat text: invalid bytes become U+FFFD (the
|
||||
implementation does not drop the row). Control and bidi formatting
|
||||
|
|
@ -334,9 +360,7 @@ one application frame, close — see Transport). Nothing else changes about the
|
|||
session.
|
||||
|
||||
The ratchet header is **inside** the Noise transport message, never in clear on
|
||||
the wire. That is a deliberate divergence from the shape this layer came from:
|
||||
the plan assumed a plaintext header (`dh_pub || N || PN`) ahead of the
|
||||
ciphertext, which was rejected because a plaintext header would hand an observer
|
||||
the wire. A plaintext header (`dh_pub || N || PN`) would hand an observer
|
||||
per-message counters and ratchet-key changes for no benefit — the Noise session
|
||||
already hides the frame, so the header is authenticated as AEAD associated data
|
||||
instead.
|
||||
|
|
@ -386,9 +410,8 @@ KDF_CK(chain_key):
|
|||
next_chain_key = HMAC-SHA256(chain_key, 0x02)
|
||||
```
|
||||
|
||||
`HKDF` is RFC 5869 with SHA-256 (`hkdf` 0.12), `HMAC` is SHA-256 (`hmac`
|
||||
0.12). Each side of an epoch derives its chains from one shared DH output with
|
||||
`KDF_RK` called **twice**:
|
||||
`HKDF` is RFC 5869 with SHA-256, `HMAC` is SHA-256. Each side of an epoch
|
||||
derives its chains from one shared DH output with `KDF_RK` called **twice**:
|
||||
|
||||
```
|
||||
epoch_chains(root, shared) -> (new_root, ck_lo, ck_hi):
|
||||
|
|
@ -520,11 +543,9 @@ lets the peer step too.
|
|||
`ratchet_sessions` in the SQLCipher store: one row per friend
|
||||
(`friend_id` primary key, `FOREIGN KEY` → `friends.id` `ON DELETE CASCADE`,
|
||||
`state BLOB NOT NULL`, `updated_at`). The blob is version byte `0x01` followed by
|
||||
the implementation's serialized `RatchetState` (root, keypairs, both chain keys
|
||||
and counters, `established`, and the skipped-key store). The state is
|
||||
device-local: it is **never** transmitted, and its layout is not part of this
|
||||
wire protocol. The store is encrypted as a whole, so the blob is ciphertext on
|
||||
disk.
|
||||
the implementation's serialized ratchet state. The state is device-local: it is
|
||||
**never** transmitted, and its layout is not part of this wire protocol. The
|
||||
store is encrypted as a whole, so the blob is ciphertext on disk.
|
||||
|
||||
### Not ratcheted
|
||||
|
||||
|
|
@ -570,8 +591,13 @@ Unknown `k`: prompt. Same `k`: update onion and prekey only.
|
|||
|
||||
## What v1 will not grow into
|
||||
|
||||
No DHT, no hosted server, no XMPP, no store-and-forward, no multi-device, no
|
||||
A/V, no STUN/ICE/WebRTC, no SOCKS/C-tor fallback, no system DNS for friends.
|
||||
No DHT, no directory server, no hosted/server-side outbox, no XMPP/Prosody, no
|
||||
C-tor fallback, no multi-device, no A/V, no STUN/ICE/WebRTC, no system DNS for
|
||||
friends.
|
||||
|
||||
A **local-only** chat retry queue is in v1. It is not a mailbox and it never
|
||||
leaves the device. “No outbox” in this document means **no server-side**
|
||||
store-and-forward.
|
||||
|
||||
Those are how Tox-over-Tor leaks (UDP DHT, mixed clearnet, “just one direct
|
||||
path”). They are out of scope, not postponed.
|
||||
|
|
|
|||
Loading…
Reference in a new issue