Expand description
Invites: the link that finds a server from anywhere, and the code in it that lets someone make their own account there.
An invite is one string, shown as a QR code and pasted as it is:
spoolframe://invite?server=<endpoint id>&name=<name>&addr=<ip:port>&relay=<url>&exp=<unix seconds>&role=<consumer|admin>&cap=<code>
Sent as text it has an https form, which Messages and Mail make
tappable and the apps open as a universal link, with the same query
after #: https://spoolframe.app/i#server=…&cap=…. A browser never
sends a fragment, so the site never sees a code, an address or a
server’s key. A QR code stays spoolframe://: it is scanned in the
same room and never needs the site. parse_link reads both.
server, the hexEndpointId, is the only parameter a link must have. A client pins it as it is: the link came from the server’s admin, so there is nothing to trust on first use.name,addr(repeated, one per address) andrelay(repeated) are hints for finding it. Iroh still proves the key whatever path is taken.capis the invite’s code, the capability that makes an account (RedeemInvite). Without it the link only finds and saves the server.expandroleare hints for the join form (“Joins as a consumer · expires Oct 14”). The server enforces its own when the code is redeemed, and a link without them works the same.kind=portable-account: the code grants a portable identity access (RedeemPortableInvite) rather than making an account. Absent, it makes an account (RedeemInvite). A hint for which form to show: the server answers the other request withWrongInviteKind.kind=federation(experimental): the code pairs another server with this one; that server’s admin redeems it (PairServer, or the admin API’sfederation_redeem).
Values are percent-encoded where they would break the link (&, =,
#, %, +, spaces, anything outside ASCII); : and / stay as
they are, so addresses and URLs read as themselves. A parameter this
build does not know is ignored, as in the device sign-in link
(crate::device_sign_in::parse_link), and so is a hint that cannot
be read: a newer server may add both.
The code is of the setup code’s class: 12 characters from an alphabet
with nothing to misread, about 59 bits, shown in groups of four
(QW7K-2MFP-XR4T). People may type it with any case, dash or spacing;
normalize_code takes all of them.
Structs§
- Invite
- What an invite link holds.
Enums§
- Invite
Link Kind - What an invite link’s code does, as the link says.
Constants§
- CODE_
ALPHABET - The characters an invite code is made of: no 0/O, 1/I/L or U.
- CODE_
LEN - Characters in a code: 30^12, about 59 bits.
- MAX_
HINTS - The most
addrorrelayhints a link is read with; any after them are left out, so a link cannot make a client keep or dial without end. - MAX_
LINK - The longest link read, in bytes. A QR code holds a few hundred; a pasted link past this is not one a server wrote.
Functions§
- display_
code codeas shown:QW7K-2MFP-XR4T.- is_
relay_ url - Whether
valuemay be a relay’s URL:https://orhttp://and a host, and nothing an opener could read another way. The SDK holds a server’s pushed relays and lookup to it as well. - normalize_
code inputas a code (QW7K2MFPXR4T), whatever case, dashes or spaces it was typed with;Noneif it cannot be one.- parse_
link - The invite
textholds, in either form;Noneif it is not an invite link: another scheme or site, noserver, aserverthat is not a key, or acapthat is not a code (a damaged link, not one without a code).