Skip to main content

Module federation

Module federation 

Source
Expand description

FederationPull — a peer server pulling one shared album from its home server.

§There is no federation protocol to speak

design/federation.md introduces no new data protocol: a peer pulls through exactly the primitives a client pulls through, GET /v1/sync?album_id= and GET /v1/blob/{hash}, with a capability token in the Authorization: Bearer slot instead of a session access token. So this module is orchestration over generated calls and contains no parser: the page comes back through SyncConsumer::pull_album, the bytes through the generated get_blob fed into the same self-verifying RangedFetcher every download uses, and the lifecycle calls are the generated refresh_capability and revoked_jti.

§The pull is gated on a fresh revocation list, and fails closed

A capability is a bearer token: the only thing that can take one back before it expires is the home server’s published list at /.well-known/capsule/revoked-jti. So a puller does not present a token it has not recently checked. FederationPull refreshes its snapshot when the one it holds is older than the list’s own max_staleness_seconds, refuses to pull when the snapshot cannot be refreshed past that bound (FederationError::ListStale), and refuses immediately when the token’s jti is on the list (FederationError::Revoked) — the same fail-closed rule the server-side verifier applies.

Nothing here caches a decision it could re-derive: the snapshot is the list as published, and the answer is recomputed from it on every call.

§Refresh replaces the credential in place

POST /v1/federation/capabilities/refresh presents the previous capability and answers the successor; the predecessor is revoked as the successor is issued, so a puller that kept using it would refuse itself on the next poll. FederationPull::refresh therefore swaps the held token, its jti and both clients over together, under one lock.

§Every presentation is signed by the puller

A capability alone is a bearer token, so the home server admits one only with an X-Capsule-Request-Signature made by the peer its sub names, over the request’s method, path and the token itself (design/federation.md, “Request Signatures”). The puller’s operational key signs through a RequestSigner it is handed rather than one this crate holds: the key is the peer server’s, and where it lives (memory, a file, an HSM) is the server’s business. Every request is signed afresh — a new nonce, the current time — retries included, because the home server accepts each signature once.

Structs§

CapabilityBlobSource
A BlobSource over the generated get_blob, presenting a capability.
FederationPull
A peer server pulling one album it holds a capability for.
RevocationSnapshot
The revocation list as the home server last published it.

Enums§

FederationError
Why a federated pull could not proceed.

Constants§

REQUEST_CONTEXT
The domain separator a request signature’s claim opens with (design/federation.md).

Traits§

RequestSigner
What signs a puller’s capability presentations: its operational Ed25519 key, the one the home server’s operator pinned for it.