77 Commits
Author SHA1 Message Date
Jannis Braun 9cdc5921d9 docs: clarify that livekit_unavailable is emitted from sendFederatedCallStart, not sendCallRelay 2026-04-21 14:08:31 +02:00
Jannis Braun 740dae298d docs: document call-relay auto-peering and dm_call_undeliverable surface 2026-04-21 14:05:59 +02:00
Jannis Braun ea8f786c2b docs: document pending peering approval queue, new endpoints, and awaiting_approval status 2026-04-20 15:16:07 +02:00
Jannis Braun 7366b56fdf docs: document auto-peering, rejected status, autoAcceptPeering setting 2026-04-09 14:01:11 +02:00
Jannis Braun d58464fe95 docs: document profile image file replication in federation spec 2026-04-08 16:59:55 +02:00
Jannis Braun e3742e199a docs: fix endpoint references and messageId format in relay docs 2026-04-07 22:46:49 +02:00
Jannis Braun 28624343d0 docs: document S2S DM close/reopen relay events
Add federation.md section 8b covering dm_close/dm_reopen relay events:
payload, outbound queueing via queueDmCloseRelay, inbound processDmCloseEvent/
processDmReopenEvent handlers (lookup-only identity resolution, silent
no-ops on missing channel/user/membership), and the processCreateEvent
closed-state reopen bug fix.

Update dm-system.md soft-close section with federation behaviour: relay
to peers for both close and reopen, relayed-message reopen in
processCreateEvent, and the federatedId-only guard for legacy DMs.
2026-04-07 22:43:04 +02:00
Jannis Braun 1ada46baff fix: relay mark_unread to peers, fix docs and timestamp consistency
- Add queueReadStateRelay call in handleMarkUnread (skip '0' sentinel)
- Fix double Date.now() in queueReadStateRelay (use single const)
- Fix federation.md: read state relay uses outbox (not fire-and-forget),
  correct payload schema to match implementation
2026-04-07 20:08:31 +02:00
Jannis Braun 626a8ded50 docs: update subsystem specs for cross-instance DM access
Document read_state_update relay event, lifted DM gates,
federatedId dedup, and relaxed authority check.
2026-04-07 20:01:43 +02:00
Jannis Braun a023c85cad docs: document S2S profile sync relay and write-protection guard 2026-04-07 14:01:44 +02:00
Jannis Braun 0ff20beedf docs: update subsystem docs for federation identity delete feature 2026-04-03 02:51:50 +02:00
Jannis Braun 39dce67a7f docs: update specs for S2S DM unification and typing relay 2026-04-01 12:59:45 +02:00
Jannis Braun 02fa64c3f3 docs: add client-federation.md and cross-reference with federation.md
The client-side federation model (instanceStore, federated accounts,
multi-instance connections, origin-aware routing) was completely
undocumented. An agent reading only federation.md would understand S2S
relay but have no knowledge of how the client connects to multiple
instances, creates federated accounts with real credentials, or routes
API/WS calls to the correct instance.

New spec covers: instanceStore architecture, federated account creation
(username@instance format), Connections UI, auto-connect lifecycle,
channelOriginMap routing, WebSocket multiplexing, cross-instance
identity resolution, and the relationship between client-side and S2S
federation.

CLAUDE.md subsystem table updated. Both federation docs cross-reference
each other.
2026-04-01 11:47:40 +02:00
Jannis Braun 91362493ea docs: update federation spec for homeward relay and DM federatedId 2026-04-01 03:59:07 +02:00
Jannis Braun 620649ec41 docs: update spec and federation docs to match implementation
- Spec: status → Implemented, fix PATCH peer as new (not pre-existing),
  correct API paths, update component breakdown to match actual structure
- Federation docs: update relay rate limit from 30 to 90 req/min
2026-04-01 02:15:37 +02:00
Jannis Braun 4a39b503db docs: update federation admin endpoints for PATCH peer and permanent delete 2026-04-01 01:55:10 +02:00
Jannis Braun df4691053f docs: remove stale known-issue references from federation spec 2026-04-01 00:12:17 +02:00
Jannis Braun 274b6a0b2f docs: update federation and voice docs for FED-009 federated DM calls 2026-03-31 23:46:19 +02:00
Jannis Braun 35c8c66dac docs: clean federation spec — remove resolved issue artifacts, describe current architecture 2026-03-31 22:03:28 +02:00
Jannis Braun f91312a6d9 docs: update federation docs for FED-011 secret rotation 2026-03-31 20:51:30 +02:00
Jannis Braun 720a5de945 fix(federation): add strict origin enforcement for user attribution (FED-010)
Prevent malicious peers from forging events attributed to users on other
instances. Every relay event processor now verifies the acting user's
homeInstance (from payload) matches X-Federation-Origin (from HMAC-verified
header) via verifyAttribution(), normalized to bare domain.

- Add verifyAttribution() helper using extractDomain normalization
- Guard all 13 event processors before any user resolution or DB writes
- Add homeInstance to FederationRelayReaction type + outbound payloads
- Replace unnormalized string equality in friend handlers
- Log mismatched values on rejection for debugging
2026-03-31 19:16:48 +02:00
Jannis Braun d0ed43cf58 fix(federation): add nonce length validation and fix verification flow docs (FED-008) 2026-03-31 18:18:50 +02:00
Jannis Braun 9961d9012b docs: update federation docs for FED-008 replay attack protection 2026-03-31 18:14:23 +02:00
Jannis Braun 75504e07c0 fix(federation): add per-peer rate limiting to relay endpoint (FED-007)
Sliding-window rate limiter (30 req/min per peer origin) on POST
/api/federation/relay, matching the existing accept endpoint pattern.
Returns 429 when exceeded — outbox workers retry with backoff. Check
runs before HMAC verification to avoid wasted computation on floods.
2026-03-31 17:33:57 +02:00
Jannis Braun 2cac39a460 fix(federation): replace DNS hairpin self-POST with direct function call (FED-005)
Extract processRelayEvents() from the relay HTTP handler and call it
directly in runInitialSyncForNewPeers(), eliminating the HTTP round-trip
through public DNS that failed on networks without hairpin NAT.
2026-03-31 05:20:16 +02:00
Jannis Braun c7bdfef038 docs: update federation identity resolution and auth specs for FED-006 fix
- Document extractDomain, findFederatedUser, updated resolveOrCreateReplicatedUser
- Update origin normalization table to reflect bare domain storage
- Mark Known Issue #2 (duplicate user stubs) as resolved
- Document federated stub upgrade behavior in auth registration flow
2026-03-31 04:55:51 +02:00
Jannis Braun a3a7527c9e chore: add system docs, specs, and misc updates from other sessions
- Add complete docs/systems/ reference (18 system docs)
- Add federation relay status doc and prior spec/plan docs
- Remove superseded docs/federation-dm-s2s.md (replaced by docs/systems/federation.md)
- CLAUDE.md updates
- Minor fixes in social.ts, types.ts, AddDmMemberModal, NewDmModal, UserSettings
2026-03-31 03:40:34 +02:00