[relay] Files: a file route for same-size encrypted chunks with its own quotas; the client seals chunks in STREAM and sends a file payload inside MLS
ci / check (pull_request) Has been cancelled

The relay stores files (id, upload and fetch token hashes, chunk count, uploaded hour) and chunks
(file id, index, ciphertext): every chunk is 256 000 bytes, so it learns the size rounded up to
250 KiB and nothing finer, and it keeps no fetch count. Only the uploader's token puts or deletes,
only the fetch token gets, a chunk never changes; per-file and relay-wide quotas answer 507; files
go after 30 days, incomplete ones after 24 hours. The client pads a file to whole chunks and seals
each with ChaCha20-Poly1305 in the aead crate's STREAM, under a key made for that file; the key,
name, type, size and thumbnail travel only in the new `file` payload, which shares `seq` with text.
Also: every route now answers a bare 413 (axum's own carried a text). PROTOCOL.md §1, §4, §5, §7, §8.
This commit is contained in:
2026-11-22 19:29:37 +01:00
parent 4d0dac0591
commit 3a0944ebff
20 changed files with 2352 additions and 42 deletions
+3 -2
View File
@@ -1,5 +1,5 @@
//! `tabellarius-relay [--listen 127.0.0.1:8470] [--db tabellarius-relay.db] [--max-bytes N]
//! [--max-mailboxes N] [--max-invites N] [--push-loopback]`
//! [--max-mailboxes N] [--max-invites N] [--max-files N] [--max-file-bytes N] [--push-loopback]`
//!
//! Prints one line at start (version and address) and nothing per request.
@@ -53,7 +53,8 @@ async fn main() {
tabellarius_protocol::VERSION
);
// Purge at start and every hour: blobs after 30 days, invites after their expiry.
// Purge at start and every hour: blobs and files after 30 days, files not complete after a
// day, invites after their expiry.
let purger = Arc::clone(&store);
tokio::spawn(async move {
let mut every_hour = tokio::time::interval(Duration::from_secs(3600));