summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2014-11-16 20:59:10 -0500
committerirungentoo <irungentoo@gmail.com>2014-11-16 20:59:10 -0500
commita9c2fe99d590a63fe6bc984e939f1066c1ea7a58 (patch)
tree854637b8dd24b71639a118f83b24a2ce113da900 /docs
parent76d14acafa240ba9780a30061bd1b4663255f2fc (diff)
Added an unfinished doc on how groupchats work.
Diffstat (limited to 'docs')
-rw-r--r--docs/Group-Chats.md74
1 files changed, 39 insertions, 35 deletions
diff --git a/docs/Group-Chats.md b/docs/Group-Chats.md
index 5e00b550..5fb45844 100644
--- a/docs/Group-Chats.md
+++ b/docs/Group-Chats.md
@@ -1,44 +1,49 @@
1Massive public group chats. 1Group chats.
2 2
3Note that not all this document has been implemented: only private (invite only) group chats are currently implemented. 3Note: we assume everyone in the chat trusts each other.
4 4
5Everyone generates a short term public private key pair right before joining 5These group chats work by temporarily adding the 4 "closest" people defined by a distance function
6the chat. 6in group.c in order to form a circle of connected peers. These peers then relay messages to each other.
7 7
8Note that for public group chats it is impossible to protect the chat from 8A friend invites another friend to a group chat by sending them an invite packet. The friend either ignores
9being spied on by a very dedicated attacker, encryption is therefor used as a 9the invite or responds with a response packet if he wants to join the chat. The friend invite contains the type
10form of spam/access control. 10of groupchat (text only, A/V) the friend is being invited to.
11
12## Joining the chats
13 11
12TODO: write more of this.
14 13
15## Protocol 14## Protocol
16 15
16Invite packets:
17Invite packet:
18[uint8_t id 96][uint8_t id 0][uint16_t group chat number][33 bytes group chat identifier[1 byte type][32 bytes id]]
19
20Response packet
21[uint8_t id 96][uint8_t id 1][uint16_t group chat number(local)][uint16_t group chat number to join][33 bytes group chat identifier[1 byte type][32 bytes id]]
22
23
24Peer online packet:
25[uint8_t id 97][uint16_t group chat number][33 bytes group chat identifier[1 byte type][32 bytes id]]
26
27Peer leave packet:
28[uint8_t id 98][uint16_t group chat number][uint8_t id 1]
17 29
18Node format: 30Peer query packet:
19See DHT, currently uses the IPv6 Node_format. 31[uint8_t id 98][uint16_t group chat number][uint8_t id 4]
20 32
21Get nodes (Request): 33Peer response packet:
22Packet contents: 34[uint8_t id 98][uint16_t group chat number][uint8_t id 5][Repeated times number of peers: [uint16_t peer num][uint8_t 32bytes real public key][uint8_t 32bytes temp DHT public key][uint8_t name length][name]]
23```
24[char with a value of 48][Bob's (The receiver'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, private key of the sender and public key of the receiver:[char with a value of 48][random 8 byte (ping_id)]
25```
26Valid replies: a send_nodes packet
27 35
28Send_nodes (response):
29```
30[char with a value of 48][Bob's (The receiver'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, private key of the sender and public key of the receiver:[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 36
33Broadcast packet: 37Message packets:
34``` 38[uint8_t id 99][uint16_t group chat number][uint16_t peer number][uint32_t message number][uint8_t with a value representing id of message][data]
35[char with a value of 48][Bob's (The receiver's) Public key (client_id) (32 bytes))][Alice's (The sender's) Public key (client_id) (32 bytes)][nonce][Encrypted with the nonce, private key of the sender and public key of the receiver:[char with a value of 50][Data to send to everyone]]
36```
37 39
40Lossy Message packets:
41[uint8_t id 199][uint16_t group chat number][uint16_t peer number][uint16_t message number][uint8_t with a value representing id of message][data]
42
43Group chat types:
440: text
451: AV
38 46
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 47
43Note: the message number is increased by 1 for each sent message. 48Note: the message number is increased by 1 for each sent message.
44 49
@@ -49,14 +54,10 @@ No data.
49 54
5016 - new_peer 5516 - new_peer
51Tell everyone about a new peer in the chat. 56Tell everyone about a new peer in the chat.
52[uint8_t public_key[public_key_len]] 57[uint16_t peer_num][uint8_t 32bytes real public key][uint8_t 32bytes temp DHT public key]
53
5417 - ban_peer
55Ban a peer
56[uint8_t public_key[public_key_len]]
57 58
5818 - topic change 5917 - kill_peer
59[uint8_t topic[topiclen]] 60[uint16_t peer_num]
60 61
6148 - name change 6248 - name change
62[uint8_t name[namelen]] 63[uint8_t name[namelen]]
@@ -69,3 +70,6 @@ Ban a peer
69 70
7065 - action (/me) 7165 - action (/me)
71[uint8_t message[messagelen]] 72[uint8_t message[messagelen]]
73
74
75