TryQuiet / quiet

A private, p2p alternative to Slack and Discord built on Tor & IPFS
https://www.tryquiet.org
GNU General Public License v3.0
1.93k stars 82 forks source link

QSS: Add channels, messages, certificates to server invite data #2406

Open leblowl opened 5 months ago

leblowl commented 5 months ago

The invite data should contain enough information for a peer to be able to connect to other peers, see channels and messages, and validate messages.

In order to connect to other peers, the minimum we need is a list of peer addresses, the community network PSK, and the owner’s OrbitDB identity. This is what exists in our current invite links. Additionally, we need ownerOrbitDbIdentity to validate CommunityMetadata which we need in order to validate Certificates which we need in order to validate Messages. Channels are needed also to see messages. So I think we will need the following pieces of data:

InviteData (JSON): psk ownerOrbitDbIdentity peerList

CommunityMetadata (JSON OrbitDB entry)

Certificates (JSON array of OrbitDB entries)

Messages (JSON array of OrbitDB entries)

Channels (JSON array of OrbitDB entries)

We can include this in one JSON object returned by the /invite API endpoint, so that could look something like this:

{
  invite: {
    psk: string 
    ownerOrbitDbIdentity: string
    peerList: string[]
  },
  communityMetadata: CommunityMetadataEntry,
  certificates: CertificateEntry[],
  messages: MessageEntry[]
  channels: PublicChannelEntry[]
}
holmesworcester commented 4 months ago

We have discussed this issue a bit, but I think it works as is and is good to proceed on. @leblowl any objections?

adrastaea commented 4 months ago

Based on @holmesworcester comment on #2432, I think we should leave out message entries since we intend for users to be able to incrementally download message data from the QSS server.

holmesworcester commented 4 months ago

@adrastaea sorry for wobbling on this, but let's include message data.