diff options
Diffstat (limited to 'docs/Group_chats.txt')
-rw-r--r-- | docs/Group_chats.txt | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/docs/Group_chats.txt b/docs/Group_chats.txt new file mode 100644 index 00000000..0da6da04 --- /dev/null +++ b/docs/Group_chats.txt | |||
@@ -0,0 +1,71 @@ | |||
1 | Massive public group chats. | ||
2 | |||
3 | Everyone generates a short term public private key pair right before joining | ||
4 | the chat. | ||
5 | |||
6 | Note that for public group chats it is impossible to protect the chat from | ||
7 | being spied on by a very dedicated attacker, encryption is therefor used as a | ||
8 | form of spam/access control. | ||
9 | |||
10 | ## Joining the chats | ||
11 | |||
12 | |||
13 | ## Protocol | ||
14 | |||
15 | |||
16 | Node format: | ||
17 | ``` | ||
18 | [char array (node_id), length=32 bytes][ip (in network byte order), length=4 bytes][port (in network byte order), length=2 bytes][Padding , length=2 bytes] | ||
19 | ``` | ||
20 | |||
21 | Get nodes (Request): | ||
22 | Packet contents: | ||
23 | ``` | ||
24 | [char with a value of 48][Bob's (The reciever's) Public key (client_id) (32 bytes))][Alice's (The sender's) Public key (client_id) (32 bytes)][Random nonce (24 bytes)][Encrypted with the nonce and private key of the sender:[char with a value of 48][random 8 byte (ping_id)] | ||
25 | ``` | ||
26 | Valid replies: a send_nodes packet | ||
27 | |||
28 | Send_nodes (response): | ||
29 | ``` | ||
30 | [char with a value of 48][Bob's (The reciever's) Public key (client_id) (32 bytes))][Alice's (The sender's) Public key (client_id) (32 bytes)][Random nonce (24 bytes)][Encrypted with the nonce and private key of the sender:[char with a value of 49][random 8 byte (ping_id)][Nodes in node format, length=40 * (number of nodes (maximum of 6 nodes)) bytes]] | ||
31 | ``` | ||
32 | |||
33 | Broadcast packet: | ||
34 | ``` | ||
35 | [char with a value of 48][Bob's (The reciever's) Public key (client_id) (32 bytes))][Alice's (The sender's) Public key (client_id) (32 bytes)][nonce][Encrypted with the nonce and private key of the sender:[char with a value of 50][Data to send to everyone]] | ||
36 | ``` | ||
37 | |||
38 | |||
39 | Data to send to everyone: | ||
40 | TODO: signing and spam control + permissions. | ||
41 | [client_id of sender][uint32_t message number][char with a value representing id of message][data] | ||
42 | |||
43 | Note: the message number is increased by 1 for each sent message. | ||
44 | |||
45 | message ids: | ||
46 | 0 - ping | ||
47 | sent every ~60 seconds by every peer. | ||
48 | No data. | ||
49 | |||
50 | 16 - new_peer | ||
51 | Tell everyone about a new peer in the chat. | ||
52 | [uint8_t public_key[public_key_len]] | ||
53 | |||
54 | 17 - ban_peer | ||
55 | Ban a peer | ||
56 | [uint8_t public_key[public_key_len]] | ||
57 | |||
58 | 18 - topic change | ||
59 | [uint8_t topic[topiclen]] | ||
60 | |||
61 | 48 - name change | ||
62 | [uint8_t name[namelen]] | ||
63 | |||
64 | 49 - status change | ||
65 | [uint8_t (status id)] | ||
66 | |||
67 | 64 - chat message | ||
68 | [uint8_t message[messagelen]] | ||
69 | |||
70 | 65 - action (/me) | ||
71 | [uint8_t message[messagelen]] \ No newline at end of file | ||