Skip to main content

Module invite

Module invite 

Source
Expand description

Invites (P6-01): 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 (PX-45), 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 hex EndpointId, 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) and relay (repeated) are hints for finding it. Iroh still proves the key whatever path is taken.
  • cap is the invite’s code, the capability that makes an account (RedeemInvite). Without it the link only finds and saves the server.
  • exp and role are 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 (P7-05): 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 with WrongInviteKind.
  • kind=federation (P8-01, experimental): the code pairs another server with this one; that server’s admin redeems it (PairServer, or the admin API’s federation_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§

InviteLinkKind
What an invite link’s code does, as the link says (P7-05).

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 addr or relay hints 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 (P6-07, glm E-4). A QR code holds a few hundred; a pasted link past this is not one a server wrote.

Functions§

display_code
code as shown: QW7K-2MFP-XR4T.
is_relay_url
Whether value may be a relay’s URL: https:// or http:// 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 (P6-07, glm E-3).
normalize_code
input as a code (QW7K2MFPXR4T), whatever case, dashes or spaces it was typed with; None if it cannot be one.
parse_link
The invite text holds, in either form; None if it is not an invite link: another scheme or site, no server, a server that is not a key, or a cap that is not a code (a damaged link, not one without a code).