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

Commit 25a1d19

Browse files
committed
reformat file
1 parent 0ea94a8 commit 25a1d19

File tree

1 file changed

+37
-11
lines changed
  • docs/Protocol Specifications/P2 Extensions

1 file changed

+37
-11
lines changed

docs/Protocol Specifications/P2 Extensions/chat.md

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,36 @@ title: polyproto-chat
2323

2424
### 1.1 Direct messages
2525

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.
2729

2830
### 1.2 Group messages
2931

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.
3136

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.-->
3340

3441
## 2. Encrypted channels and groups
3542

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.
3745

3846
### 2.1 Encrypted guild channels
3947

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.
4156

4257
<a id="fig-3"/>
4358

@@ -61,11 +76,16 @@ Bob->>Server: Forward: Notify group of new member: Charlie
6176
Server->>Charlie: Forward: encrypted MLS Welcome
6277
```
6378

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.
6582

6683
### 2.2 Encrypted direct messages
6784

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.
6989

7090
```mermaid
7191
sequenceDiagram
@@ -86,7 +106,9 @@ Fig. 4: Sequence diagram of a successful encrypted direct message creation.
86106

87107
### 2.3 Encrypted group messages
88108

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.
90112

91113
```mermaid
92114
sequenceDiagram
@@ -117,12 +139,16 @@ Fig. 5: Sequence diagram of a successful encrypted group creation with 3 members
117139

118140
### 2.4 Joining new devices from existing users
119141

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.
121144

122145
### 2.5 Best practices
123146

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.
126152

127153
---
128154

0 commit comments

Comments
 (0)