asynchronous user invites
currently, a pub invite encodes a private key that is used to connect to the pub that created it. if we generalize the concept of invite-as-keypair a little further, we could make invites without requiring administrative access to a pub. basically: follow publicly an invite keypair, and let the invitee use the invite keypair to follow their own feed.
more detailed flow:
- alice wants to invite bob to ssb
- alice generates a keypair K
- alice publishes a follow message following K.public
- alice encodes K, their public key, and a list of global addresses of peers that they have recently connected to, into an invite code
<K.private, alice.public, pub_addrs[]>
. alice sends this code to bob. - bob receives and decodes the invite code.
- optionally, bob publishes a contact message following alice
- bob initializes K's feed and publishes a follow message in K, following bob, with a property noting that this is a usage of a temporary feed.
- bob connects with K.private to each of
pub_addrs
until a connection succeeds and the pub requests to replicate bob's feed. - bob reconnects to the pub with their own keypair.
- later, alice replicates K's feed and bob's feed. alice may unfollow K and follow bob.
advantages:
- a user could generate their own invite codes, and could do so offline
- the follow graph could more closely map to the social layer
- core changes in scuttlebot are not required (except optionally - see below)
disadvantages:
- the invite codes are effectively single-use
- to create an invite, the user must (i think) be followed directly by a pub, because the invitee will have to be able to connect to the pub with the invite keypair (2 hops from the pub, if the pub follows the inviter), and then with their own key (3 hops from the pub). the ui could show the inviter if they cannot effectively generate an invite because they are not followed by a pub. pubs could increase their follow hops count to allow more people to use them for inviting, but i don't think there is a way currently that the inviter could detect this (except by using their own invite). possibly an sbot rpc method could be added to query the hop count, so that inviters could build a more accurate model of where they can invite peers.