Merge branch 'main' into wt/t_fc02d8b6
All checks were successful
ci / test (pull_request) Successful in 3m2s

This commit is contained in:
sirius 2026-09-12 04:11:00 +00:00
commit dcb98132e2
13 changed files with 552 additions and 21 deletions

View file

@ -144,6 +144,20 @@ Chat MUST NOT begin with three lowercase ASCII letters and a space.
Hex on the wire is lowercase on encode; decode accepts either case. No `0x`
prefix.
### Application-frame signatures
`loc`, `prf`, `inv`, and `rcp` each carry an ed25519 signature over the
**fields**, not the 4-byte typed prefix. Encode MUST sign the domain-separated
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.
The invite string is separate and keeps `onionwire-invite-v1` (see Invite).
Older builds verify only the untagged bytes, so they reject tagged signatures
(fail closed, no downgrade). Mixed-version fleets break outbound application
frames from a new sender to an old receiver until both sides are updated.
### `loc ` — locator update
Sent when the sender rotated their onion and the receiver is reachable.
@ -155,7 +169,18 @@ loc <onion>\n<ts>\n<sig_hex>
- `onion` — v3 onion (56 base32 `a-z2-7` chars + `.onion`)
- `ts` — unix seconds, decimal ASCII
- `sig_hex` — 64-byte ed25519, 128 hex chars
- signed bytes: `onion || LF || ascii(ts)` (the `loc ` prefix is **not** signed)
- the `loc ` prefix is **not** signed
**Current signature (encode this):**
```
ed25519_sign(identity_sk,
"onionwire-loc-v1" || 0x00 || onion || 0x00 || ascii(ts))
```
**Legacy accept:** a signature over `onion || LF || ascii(ts)` is still
accepted on verify so old loc frames verify. New loc frames MUST use the
domain-separated form. Do not emit legacy.
Apply only if **all** of:
@ -175,7 +200,18 @@ prf <display_name>\n<bio>\n<xmr_addr>\n<ts>\n<sig_hex>
Limits: name ≤ 64 bytes, bio ≤ 512 bytes. No newlines in those fields.
`xmr_addr` may be empty; if non-empty it MUST be a checksummed Monero address
(see invoices). Signed bytes: the four fields joined by LF (no `prf ` prefix).
(see invoices). The `prf ` prefix is **not** signed.
**Current signature (encode this):**
```
ed25519_sign(identity_sk,
"onionwire-prf-v1" || 0x00 || name || 0x00 || bio || 0x00 || xmr_addr || 0x00 || ascii(ts))
```
**Legacy accept:** a signature over the four fields joined by LF is still
accepted on verify. New profile frames MUST use the domain-separated form.
Do not emit legacy.
Apply only for an existing friend, valid signature, newer `ts`. Not a public
profile. Not a directory.
@ -188,7 +224,18 @@ inv <amount_atomic>\n<address>\n<memo>\n<ts>\n<sig_hex>
`amount_atomic` is decimal piconero (integer string, > 0). `address` is a
Monero mainnet/stagenet standard, subaddress, or integrated address with a
valid Keccak checksum. Signed bytes: the four fields joined by LF.
valid Keccak checksum. The `inv ` prefix is **not** signed.
**Current signature (encode this):**
```
ed25519_sign(identity_sk,
"onionwire-inv-v1" || 0x00 || amount_atomic || 0x00 || address || 0x00 || memo || 0x00 || ascii(ts))
```
**Legacy accept:** a signature over the four fields joined by LF is still
accepted on verify. New invoices MUST use the domain-separated form. Do not
emit legacy.
The frame is a signed claim, not a payment.
@ -198,6 +245,19 @@ The frame is a signed claim, not a payment.
rcp <txid>\n<amount_atomic>\n<address>\n<ts>\n<sig_hex>
```
The `rcp ` prefix is **not** signed.
**Current signature (encode this):**
```
ed25519_sign(identity_sk,
"onionwire-rcp-v1" || 0x00 || txid || 0x00 || amount_atomic || 0x00 || address || 0x00 || ascii(ts))
```
**Legacy accept:** a signature over the four fields joined by LF is still
accepted on verify. New receipts MUST use the domain-separated form. Do not
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`
@ -221,7 +281,7 @@ fil <xfer_id_hex>\n<filename>\n<sha256_hex>\n<idx>/<total>\n<raw bytes>
```
- `xfer_id` — 16 random bytes (32 hex)
- `filename` — 1–128 bytes, no `/`, NUL, newline, `.`, or `..`
- `filename` — 1–128 bytes, no `/`, NUL, newline, `.`, or `..`; no C0/C1 controls or bidi/format marks (U+202A–U+202E, U+2066–U+2069, U+200E, U+200F, U+200B, U+200C)
- `sha256` — SHA-256 of the **entire** file (64 hex), repeated on every chunk
- `idx` is 0-based; `total` ≥ 1; `idx < total`
- last line is raw chunk bytes (not hex), length chosen so the framed Noise
@ -233,7 +293,13 @@ is a chat line `[file] name (N bytes)`, never the raw frame.
### Chat
UTF-8 (this implementation does not enforce UTF-8). Displayed as a line.
UTF-8 is not enforced for chat text: invalid bytes become U+FFFD (the
implementation does not drop the row). Control and bidi formatting
characters are stripped at ingest and at render: C0 0x00–0x1F except
tab and newline, DEL (0x7F), C1 U+0080–U+009F, U+202A–U+202E,
U+2066–U+2069, U+200E, U+200F, U+200B, U+200C. U+200D (ZWJ) is kept
so emoji sequences stay intact. `fil ` filenames must not contain
those characters (tab and newline included). Displayed as a line.
No length limit beyond the frame cap.
## Invite (out of band)

View file

@ -52,6 +52,17 @@ intentional clearnet socket is optional `monero-wallet-rpc` on **loopback TCP**
Do not add STUN/ICE/WebRTC, a DHT, SOCKS/C-tor fallback, or “direct TCP when
the onion is slow.” Those are the Tox-over-Tor leak class.
## Peer text is untrusted display data
Chat bodies and `fil ` names come from a Noise peer, not from the local user.
They are display data, not terminal commands. A friend (or anyone who stole
that session) can put ESC/CSI/OSC, C1 controls, or bidi overrides in a
payload. OnionWire strips those at ingest (so sqlite history is clean) and
again at TUI render (so rows written before this rule stay inert). Filenames
that contain the same characters are rejected, not rewritten. This is a
UI-redressing / terminal-injection boundary, not a confidentiality control:
the peer already knows the plaintext they sent.
## Out of v1
Prosody, XMPP, s2s, MAM, carbons, outbox, multi-device, DHT / name server,