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

Commit 7f7cbe7

Browse files
committed
replace ascii diagrams with mermaid
1 parent ed07501 commit 7f7cbe7

File tree

1 file changed

+56
-112
lines changed
  • docs/Protocol Specifications/P2 Extensions

1 file changed

+56
-112
lines changed

docs/Protocol Specifications/P2 Extensions/chat.md

Lines changed: 56 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -40,73 +40,46 @@ Note, that in the below sequence diagrams, the MLS Welcome message and the MLS G
4040
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.
4141

4242
<a id="fig-3"/>
43+
44+
```mermaid
45+
sequenceDiagram
46+
participant Charlie
47+
participant Server
48+
participant Alice
49+
participant Bob
50+
51+
Charlie->>Server: Channel join request + KeyPackage
52+
Server->>Alice: Notify group of join request
53+
Alice->>Server:
54+
Server->>Alice: Channel join request + Charlie's KeyPackage
55+
Alice->>Bob: Verify Charlie's KeyPackage
56+
Bob->>Alice: Verified
57+
Alice->>Server: Notify group of new member: Charlie
58+
Server->>Alice: Encrypted MLS Welcome
59+
Server->>Bob: Forward: Notify group of new member: Charlie
60+
Bob->>Server: Forward: Notify group of new member: Charlie
61+
Server->>Charlie: Forward: encrypted MLS Welcome
4362
```
44-
Charlie Server Alice Bob
45-
| | | |
46-
| Channel join request + KeyPackage | | |
47-
|--------------------------------------------->| | |
48-
| | | |
49-
| | Notify group of join request | |
50-
| |----------------------------------- | |
51-
| | | | |
52-
| |<---------------------------------- | |
53-
| | | |
54-
| | Channel join request + Charlie's KeyPackage | |
55-
| |------------------------------------------------>| |
56-
| | | |
57-
| | | Verify Charlie's KeyPackage |
58-
| | |------------------------ |
59-
| | | | |
60-
| | |<----------------------- |
61-
| | | |
62-
| | Notify group of new member: Charlie | |
63-
| |<------------------------------------------------| |
64-
| | | |
65-
| | Encrypted MLS Welcome | |
66-
| |<------------------------------------------------| |
67-
| | | |
68-
| | Forward: Notify group of new member: Charlie | |
69-
| |------------------------------------------------------------------------------>|
70-
| | | |
71-
| Forward: Notify group of new member: Charlie | | |
72-
|<---------------------------------------------| | |
73-
| | | |
74-
| Forward: encrypted MLS Welcome | | |
75-
|<---------------------------------------------| | |
76-
| | | |
77-
```
63+
7864
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.
7965

8066
### 6.2 Encrypted direct messages
8167

8268
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.
8369

84-
```
85-
Alice Server Bob
86-
| | |
87-
| Request Bob's KeyPackages | |
88-
|--------------------------------------------->| |
89-
| | |
90-
| Bob's KeyPackages | |
91-
|<---------------------------------------------| |
92-
| | |
93-
| Verify Bob's KeyPackages | |
94-
| ------------------------ ||
95-
| | | |
96-
|<----------------------- | |
97-
| | |
98-
| Notify group of new member: Bob | |
99-
|--------------------------------------------->| |
100-
| | |
101-
| Encrypted MLS Welcome | |
102-
|--------------------------------------------->| |
103-
| | |
104-
| | Forward: New group member: Bob |
105-
| |--------------------------------->|
106-
| | |
107-
| | Forward encrypted MLS Welcome |
108-
| |--------------------------------->|
109-
| | |
70+
```mermaid
71+
sequenceDiagram
72+
participant Alice
73+
participant Server
74+
participant Bob
75+
76+
Alice->>Server: Request Bob's KeyPackages
77+
Server->>Alice: Bob's KeyPackages
78+
Alice->>Alice: Verify Bob's KeyPackages
79+
Alice->>Server: Notify group of new member: Bob
80+
Server->>Alice: Encrypted MLS Welcome
81+
Server->>Bob: Forward: New group member: Bob
82+
Server->>Bob: Forward encrypted MLS Welcome
11083
```
11184

11285
Fig. 4: Sequence diagram of a successful encrypted direct message creation.
@@ -115,58 +88,29 @@ Fig. 4: Sequence diagram of a successful encrypted direct message creation.
11588

11689
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.
11790

118-
```
119-
Alice (gatekeeper) Server Bob Charlie
120-
| | | |
121-
| Request Bob's KeyPackages | | |
122-
|------------------------------------------------->| | |
123-
| | | |
124-
| Bob's KeyPackages | | |
125-
|<-------------------------------------------------| | |
126-
| | | |
127-
| Verify Bob's KeyPackages | | |
128-
| ------------------------ || |
129-
| | | | |
130-
|<----------------------- | | |
131-
| | | |
132-
| Notify group of new member: Bob | | |
133-
|------------------------------------------------->| | |
134-
| | | |
135-
| Encrypted MLS Welcome | | |
136-
|------------------------------------------------->| | |
137-
| | | |
138-
| | Forward: New group member: Bob | |
139-
| |-------------------------------------->| |
140-
| | | |
141-
| | Forward encrypted MLS Welcome | |
142-
| |-------------------------------------->| |
143-
| | | |
144-
| Request Charlie's KeyPackages | | |
145-
|------------------------------------------------->| | |
146-
| | | |
147-
| Charlie's KeyPackages | | |
148-
|<-------------------------------------------------| | |
149-
| | | |
150-
| Verify Charlie's KeyPackages | | |
151-
| ---------------------------- || |
152-
| | | | |
153-
|<--------------------------- | | |
154-
| | | |
155-
| Notify group of new member: Charlie | | |
156-
|------------------------------------------------->| | |
157-
| | | |
158-
| Encrypted MLS Welcome | | |
159-
|------------------------------------------------->| | |
160-
| | | |
161-
| | Forward: New group member: Charlie | |
162-
| |-------------------------------------->| |
163-
| | | |
164-
| | Forward: New group member: Charlie | |
165-
| |------------------------------------------------>|
166-
| | | |
167-
| | Forward encrypted MLS Welcome | |
168-
| |------------------------------------------------>|
169-
| | | |
91+
```mermaid
92+
sequenceDiagram
93+
participant Alice as Alice (gatekeeper)
94+
participant Server
95+
participant Bob
96+
participant Charlie
97+
98+
Alice->>Server: Request Bob's KeyPackages
99+
Server->>Alice: Bob's KeyPackages
100+
Alice->>Alice: Verify Bob's KeyPackages
101+
Alice->>Server: Notify group of new member: Bob
102+
Server->>Alice: Encrypted MLS Welcome
103+
Server->>Bob: Forward: New group member: Bob
104+
Server->>Bob: Forward encrypted MLS Welcome
105+
106+
Alice->>Server: Request Charlie's KeyPackages
107+
Server->>Alice: Charlie's KeyPackages
108+
Alice->>Alice: Verify Charlie's KeyPackages
109+
Alice->>Server: Notify group of new member: Charlie
110+
Server->>Alice: Encrypted MLS Welcome
111+
Server->>Bob: Forward: New group member: Charlie
112+
Server->>Charlie: Forward: New group member: Charlie
113+
Server->>Charlie: Forward encrypted MLS Welcome
170114
```
171115

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

0 commit comments

Comments
 (0)