summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/Group_chats.txt71
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 @@
1Massive public group chats.
2
3Everyone generates a short term public private key pair right before joining
4the chat.
5
6Note that for public group chats it is impossible to protect the chat from
7being spied on by a very dedicated attacker, encryption is therefor used as a
8form of spam/access control.
9
10## Joining the chats
11
12
13## Protocol
14
15
16Node 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
21Get nodes (Request):
22Packet 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```
26Valid replies: a send_nodes packet
27
28Send_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
33Broadcast 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
39Data to send to everyone:
40TODO: signing and spam control + permissions.
41[client_id of sender][uint32_t message number][char with a value representing id of message][data]
42
43Note: the message number is increased by 1 for each sent message.
44
45message ids:
460 - ping
47sent every ~60 seconds by every peer.
48No data.
49
5016 - new_peer
51Tell everyone about a new peer in the chat.
52[uint8_t public_key[public_key_len]]
53
5417 - ban_peer
55Ban a peer
56[uint8_t public_key[public_key_len]]
57
5818 - topic change
59[uint8_t topic[topiclen]]
60
6148 - name change
62[uint8_t name[namelen]]
63
6449 - status change
65[uint8_t (status id)]
66
6764 - chat message
68[uint8_t message[messagelen]]
69
7065 - action (/me)
71[uint8_t message[messagelen]] \ No newline at end of file