You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 15, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: docs/Protocol Specifications/P2 Extensions/chat.md
+37-11Lines changed: 37 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,21 +23,36 @@ title: polyproto-chat
23
23
24
24
### 1.1 Direct messages
25
25
26
-
Federating direct messages is straightforward. When Alice sends a message to Bob, their client will send the message to Bob's home server via an API request. Bob's home server will then send the message to Bob's client via an established WebSocket connection, and vice versa.
26
+
Federating direct messages is straightforward. When Alice sends a message to Bob, their client will
27
+
send the message to Bob's home server via an API request. Bob's home server will then send the
28
+
message to Bob's client via an established WebSocket connection, and vice versa.
27
29
28
30
### 1.2 Group messages
29
31
30
-
Group messages work just like guilds, in the sense that data is stored by the home server of the group's creator, meaning that all group members will have to communicate with the group creator's home server. If the group creator leaves the group, the ownership of the group is transferred to another member. The group chat stays on the group creator's home server.
32
+
Group messages work just like guilds, in the sense that data is stored by the home server of the
33
+
group's creator, meaning that all group members will have to communicate with the group creator's
34
+
home server. If the group creator leaves the group, the ownership of the group is transferred to
35
+
another member. The group chat stays on the group creator's home server.
31
36
32
-
<!--Potential work could be done to think of a system which allows group chat members to vote for a migration of the conversation to another server. Consent is needed from all involved parties, because otherwise, data cannot ethically be transfered from one server to another another.-->
37
+
<!--Potential work could be done to think of a system which allows group chat members to vote for
38
+
a migration of the conversation to another server. Consent is needed from all involved parties,
39
+
because otherwise, data cannot ethically be transfered from one server to another another.-->
33
40
34
41
## 2. Encrypted channels and groups
35
42
36
-
Note, that in the below sequence diagrams, the MLS Welcome message and the MLS Group notify message are all encrypted using the identity key of the recipient.
43
+
Note, that in the below sequence diagrams, the MLS Welcome message and the MLS Group notify
44
+
message are all encrypted using the identity key of the recipient.
37
45
38
46
### 2.1 Encrypted guild channels
39
47
40
-
Encrypting a guild channel is done by a client with the `MANAGE_CHANNEL` permission. Upon successfully requesting enabling encryption of a channel, all future messages in it will be encrypted. Joining an encrypted channel is done by sending a join request to the server. The server will then notify the channels' members of the join request. The members will then decide whether to accept or reject the join request. If the join request is accepted by any member, that member will initiate the MLS welcoming process. If the member finds that the join request is invalid (perhaps due to an invalid `KeyPackage`), the join request must be denied. It is imperative that join requests are verified correctly by the server.
48
+
Encrypting a guild channel is done by a client with the `MANAGE_CHANNEL` permission. Upon
49
+
successfully requesting enabling encryption of a channel, all future messages in it will be
50
+
encrypted. Joining an encrypted channel is done by sending a join request to the server. The server
51
+
will then notify the channels' members of the join request. The members will then decide whether to
52
+
accept or reject the join request. If the join request is accepted by any member, that member will
53
+
initiate the MLS welcoming process. If the member finds that the join request is invalid (perhaps
54
+
due to an invalid `KeyPackage`), the join request must be denied. It is imperative that join
55
+
requests are verified correctly by the server.
41
56
42
57
<aid="fig-3"/>
43
58
@@ -61,11 +76,16 @@ Bob->>Server: Forward: Notify group of new member: Charlie
61
76
Server->>Charlie: Forward: encrypted MLS Welcome
62
77
```
63
78
64
-
Fig. 3: Sequence diagram of a successful encrypted channel join in which Alice acts as a gatekeeper. The sequence diagram assumes that Alice can verify Charlies' public key to indeed belong to Charlie, and that Alice accepts the join request.
79
+
Fig. 3: Sequence diagram of a successful encrypted channel join in which Alice acts as a gatekeeper.
80
+
The sequence diagram assumes that Alice can verify Charlies' public key to indeed belong to
81
+
Charlie, and that Alice accepts the join request.
65
82
66
83
### 2.2 Encrypted direct messages
67
84
68
-
Adding another person to a direct message is not possible, and would not make much sense, as the new person cannot see any messages that were sent before they joined the group. If Alice wants to add Charlie to a direct message with Bob, she will have to create a new direct message with Bob and Charlie.
85
+
Adding another person to a direct message is not possible, and would not make much sense, as the
86
+
new person cannot see any messages that were sent before they joined the group. If Alice wants
87
+
to add Charlie to a direct message with Bob, she will have to create a new direct message with
88
+
Bob and Charlie.
69
89
70
90
```mermaid
71
91
sequenceDiagram
@@ -86,7 +106,9 @@ Fig. 4: Sequence diagram of a successful encrypted direct message creation.
86
106
87
107
### 2.3 Encrypted group messages
88
108
89
-
Encrypted group messages work by using the traditional MLS protocol, with the additional concept of group owners. Only group owners can add new members to the group and forcibly remove others from the group. The Group owner is determined by the Client-Server API.
109
+
Encrypted group messages work by using the traditional MLS protocol, with the additional concept
110
+
of group owners. Only group owners can add new members to the group and forcibly remove others
111
+
from the group. The Group owner is determined by the Client-Server API.
90
112
91
113
```mermaid
92
114
sequenceDiagram
@@ -117,12 +139,16 @@ Fig. 5: Sequence diagram of a successful encrypted group creation with 3 members
117
139
118
140
### 2.4 Joining new devices from existing users
119
141
120
-
Regardless of channel or group permissions, a user join request from a new device should be accepted by default.
142
+
Regardless of channel or group permissions, a user join request from a new device should be
143
+
accepted by default.
121
144
122
145
### 2.5 Best practices
123
146
124
-
- In case of encrypted guild channel join requests, it may be a good idea to treat multiple join requests from the same user with different clients as a single join request, when it comes to UI/UX.
125
-
- Joining an encrypted channel, even from an already established member with a new device, should be an event distinctly visible to all members of the channel. This is to prevent a malicious user from joining a channel without the other members noticing.
147
+
- In case of encrypted guild channel join requests, it may be a good idea to treat multiple join
148
+
requests from the same user with different clients as a single join request, when it comes to UI/UX.
149
+
- Joining an encrypted channel, even from an already established member with a new device,
150
+
should be an event distinctly visible to all members of the channel. This is to prevent a
151
+
malicious user from joining a channel without the other members noticing.
0 commit comments