Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

Commit c524c85

Browse files
committed
Refine terminology, expand section 3, add trust model
1 parent 5a1339a commit c524c85

File tree

1 file changed

+69
-23
lines changed
  • docs/Protocol Specifications/P2 Extensions

1 file changed

+69
-23
lines changed

docs/Protocol Specifications/P2 Extensions/chat.md

Lines changed: 69 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,53 @@ title: polyproto-chat
2020
[Semantic versioning v2.0.0](https://semver.org/spec/v2.0.0.html) is used to version this specification.
2121

2222
- [p2-Extension: polyproto-chat](#p2-extension-polyproto-chat)
23-
- [1. Federation of Group Messages](#1-federation-of-group-messages)
24-
- [2. Encrypted channels and groups](#2-encrypted-channels-and-groups)
25-
- [2.1 Encrypted guild channels](#21-encrypted-guild-channels)
26-
- [2.2 Encrypted direct messages](#22-encrypted-direct-messages)
27-
- [2.3 Encrypted group messages](#23-encrypted-group-messages)
28-
- [2.4 Joining new devices from existing users](#24-joining-new-devices-from-existing-users)
29-
- [2.5 Best practices](#25-best-practices)
23+
- [1. Trust model](#1-trust-model)
24+
- [2. Federation Principles](#2-federation-principles)
25+
- [2.1 Messaging Groups](#21-messaging-groups)
26+
- [2.1.1 Private messages](#211-private-messages)
27+
- [2.1.2 Group messages](#212-group-messages)
28+
- [2.2 Guilds and Guild channels](#22-guilds-and-guild-channels)
29+
- [3. Encrypted channels and groups](#3-encrypted-channels-and-groups)
30+
- [3.1 Encrypted guild channels](#31-encrypted-guild-channels)
31+
- [3.2 Encrypted direct messages](#32-encrypted-direct-messages)
32+
- [3.3 Encrypted group messages](#33-encrypted-group-messages)
33+
- [3.4 Joining new devices from existing users](#34-joining-new-devices-from-existing-users)
34+
- [3.5 Best practices](#35-best-practices)
3035
- [polyproto-chat specific glossary](#polyproto-chat-specific-glossary)
3136
- [General glossary](#general-glossary)
3237

33-
## 1. Federation of Group Messages
38+
## 1. Trust model
39+
40+
polyproto-chat inherits its trust model from the core polyproto specification. In addition, the
41+
following trust assumptions are added:
42+
43+
1. Unencrypted messages can only be read by users with the necessary permissions to access the channel
44+
the message was sent to, at the point the message was sent, or in the future. In addition,
45+
server moderators, -administrators and other entities who can access the infrastructure the
46+
server is hosted on are always able to read unencrypted messages, whether through directly
47+
accessing this information or because of a report that was filed by another user.
48+
2. Unencrypted metadata can be accessed by the same set of people described in 1.
49+
3. Server moderators, -administrators, other entities who may gain access to the infrastructure the
50+
server is hosted on and other polyproto-chat users can not read encrypted messages or -metadata in
51+
plain text, if they are not themselves part of the MLS group the message was sent in.
52+
4. Extending 3., server moderators, -administrators and other entities have **no way** to gain insight
53+
into the contents of an encrypted message, if they are not themselves part of the MLS group the
54+
message was sent in.
55+
5. Compromise of an encrypted communications channel will not expose past communications.
56+
6. After an encrypted communications channel has been compromised, it is possible to re-establish
57+
the security/secrecy guarantees (post-compromise security).
58+
59+
!!! danger
60+
61+
Human error, faulty software or malicious actions can always lead to unauthorized access to
62+
information, encrypted or not. This is true for every user-facing application employing encryption
63+
*ever*, not just polyproto-chat.
64+
65+
## 2. Federation Principles
66+
67+
This section explains how the federation in different parts of polyproto-chat works.
68+
69+
## 2.1 Messaging Groups
3470

3571
Every messaging group is also an MLS group. Messaging groups are always encrypted using the MLS
3672
protocol and shared cipher suites. A direct messaging group between two actors is also treated as
@@ -47,6 +83,8 @@ they send on the server which acts as their primary service provider for the pol
4783
With multiple servers participating in a conversation, a server outage only affects the messages
4884
stored on that server, not the entire messaging group.
4985

86+
### 2.1.1 Private messages
87+
5088
The below sequence diagram showcases how a private messaging channel between two actors with different
5189
service providers works.
5290

@@ -87,7 +125,12 @@ opt Alice wants to fetch her message at a later point
87125
end
88126
```
89127

90-
*Fig. 1: Message sending and message retrieval in a messaging group.*
128+
*Fig. 1: Message sending and message retrieval in a private messaging group.*
129+
130+
If the actors use the same primary service provider for the `chat` service, steps (4) and (9) do
131+
not apply.
132+
133+
### 2.1.2 Group messages
91134

92135
Below, you can find a condensed sequence diagram showcasing how a messaging group with > 2 actors
93136
works:
@@ -121,23 +164,26 @@ end
121164
note over a,c: Fetching messages works the same way as showcased in Fig. 1.
122165
```
123166

124-
vvv
167+
*Fig. 2: Message sending and message retrieval in a messaging group.*
168+
169+
If two actors have the same primary service provider for the `chat` service, steps facilitating
170+
communication across servers do not apply.
171+
172+
## 2.2 Guilds and Guild channels
173+
174+
Unlike messaging groups, guild channels are not encrypted by default.
125175

126-
Group messages work just like guilds, in the sense that data is stored by the home server of the
127-
group's creator, meaning that all group members will have to communicate with the group creator's
128-
home server. If the group creator leaves the group, the ownership of the group is transferred to
129-
another member. The group chat stays on the group creator's home server.
176+
!!! question "Why are guild channels not encrypted by default?"
130177

131-
<!--Potential work could be done to think of a system which allows group chat members to vote for
132-
a migration of the conversation to another server. Consent is needed from all involved parties,
133-
because otherwise, data cannot ethically be transfered from one server to another another.-->
178+
In the real world, most guilds are used as spaces for open communities where people join and leave
179+
freely.
134180

135-
## 2. Encrypted channels and groups
181+
## 3. Encrypted channels and groups
136182

137183
Note, that in the below sequence diagrams, the MLS Welcome message and the MLS Group notify
138184
message are all encrypted using the identity key of the recipient.
139185

140-
### 2.1 Encrypted guild channels
186+
### 3.1 Encrypted guild channels
141187

142188
Encrypting a guild channel is done by a client with the `MANAGE_CHANNEL` permission. Upon
143189
successfully requesting enabling encryption of a channel, all future messages in it will be
@@ -174,7 +220,7 @@ Fig. 3: Sequence diagram of a successful encrypted channel join in which Alice a
174220
The sequence diagram assumes that Alice can verify Charlies' public key to indeed belong to
175221
Charlie, and that Alice accepts the join request.
176222

177-
### 2.2 Encrypted direct messages
223+
### 3.2 Encrypted direct messages
178224

179225
Adding another person to a direct message is not possible, and would not make much sense, as the
180226
new person cannot see any messages that were sent before they joined the group. If Alice wants
@@ -200,7 +246,7 @@ Server->>Bob: Forward encrypted MLS Welcome
200246

201247
Fig. 4: Sequence diagram of a successful encrypted direct message creation.
202248

203-
### 2.3 Encrypted group messages
249+
### 3.3 Encrypted group messages
204250

205251
Encrypted group messages work by using the traditional MLS protocol, with the additional concept
206252
of group owners. Only group owners can add new members to the group and forcibly remove others
@@ -235,12 +281,12 @@ Server->>Charlie: Forward encrypted MLS Welcome
235281

236282
Fig. 5: Sequence diagram of a successful encrypted group creation with 3 members.
237283

238-
### 2.4 Joining new devices from existing users
284+
### 3.4 Joining new devices from existing users
239285

240286
Regardless of channel or group permissions, a user join request from a new device should be
241287
accepted by default.
242288

243-
### 2.5 Best practices
289+
### 3.5 Best practices
244290

245291
- In case of encrypted guild channel join requests, it may be a good idea to treat multiple join
246292
requests from the same user with different clients as a single join request, when it comes to UI/UX.

0 commit comments

Comments
 (0)