Expand description
Who a relay of the server’s own lets through.
The relay runs as a process of its own (spoolframe-server relay),
with no users of its own: it asks the main server, over an Iroh
connection on RELAY_ACCESS_ALPN, which tier an endpoint that
connects to it is in. The main server answers only the relays its
config names. One bidirectional stream per question: an
AccessQuery frame, answered by an AccessAnswer frame.
A device redeeming an invite is no one’s yet: it proves it holds the
code with an invite_token, which the relay reads from the
Authorization header of its connection and passes in the question.
A device about to play a paired server’s item proves it holds
that server’s play token the same way, with a play_relay_token.
The main server tells its relays when an answer no longer holds: on a
unidirectional stream it opens on the relay’s connection, an
AccessRevoked frame. A relay forgets what it kept for that endpoint
and asks again about those it carries.
Structs§
- Access
Answer - The tier of the endpoint asked about.
- Access
Query - Which tier
endpointis in. - Access
Revoked - The main server’s word that what it answered for
endpointno longer holds: a paired server unpaired, or moved to a new key.
Enums§
- Tier
- Who an endpoint is to the main server, for its relay.
Constants§
- INVITE_
TOKEN_ PREFIX - What an invite holder’s token starts with: its scheme and version.
- MAX_
FRAME - The most bytes an access frame takes, on either side: a query, an answer or a revocation is a key and some framing, so anything larger is not one.
- PLAY_
TOKEN_ PREFIX - What a play token holder’s relay token starts with.
- RELAY_
ACCESS_ ALPN - The ALPN a relay asks the main server on.
Functions§
- invite_
mac - What a token for the invite whose code hashes to
code_hashcarries, asendpoint: the server keeps only the hash, and checks with this. - invite_
token - The token whoever holds invite
codeconnects to the server’s relay with, asendpoint(its key’s bytes):sf-invite.1.and the base64url of BLAKE3 keyed with the code’s hash, over the key. It proves the code without carrying it, and admits no other endpoint: the relay’s handshake proved the key it was made for.Nonefor a code that cannot be one. - is_
relay_ token - Whether
tokenis one a relay passes on: an invite holder’s or a play token holder’s. - parse_
invite_ token - The MAC
tokencarries, if it is an invite holder’s token at all. The relay passes on only these, and play token holders’ (is_relay_token): anything else is no token. - parse_
play_ token - The MAC
tokencarries, if it is a play token holder’s relay token. - play_
relay_ token - The token whoever holds paired-server play token
tokenconnects to that server’s relay with, asendpoint:sf-play.1.and the base64url of BLAKE3 keyed with the play token’s hash, over the key, as an invite holder’s is made with the code’s. The server keeps only the play token’s hash, and checks with it.