diff options
author | irungentoo <irungentoo@gmail.com> | 2014-11-16 20:59:10 -0500 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2014-11-16 20:59:10 -0500 |
commit | a9c2fe99d590a63fe6bc984e939f1066c1ea7a58 (patch) | |
tree | 854637b8dd24b71639a118f83b24a2ce113da900 /docs | |
parent | 76d14acafa240ba9780a30061bd1b4663255f2fc (diff) |
Added an unfinished doc on how groupchats work.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/Group-Chats.md | 74 |
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 @@ | |||
1 | Massive public group chats. | 1 | Group chats. |
2 | 2 | ||
3 | Note that not all this document has been implemented: only private (invite only) group chats are currently implemented. | 3 | Note: we assume everyone in the chat trusts each other. |
4 | 4 | ||
5 | Everyone generates a short term public private key pair right before joining | 5 | These group chats work by temporarily adding the 4 "closest" people defined by a distance function |
6 | the chat. | 6 | in group.c in order to form a circle of connected peers. These peers then relay messages to each other. |
7 | 7 | ||
8 | Note that for public group chats it is impossible to protect the chat from | 8 | A friend invites another friend to a group chat by sending them an invite packet. The friend either ignores |
9 | being spied on by a very dedicated attacker, encryption is therefor used as a | 9 | the invite or responds with a response packet if he wants to join the chat. The friend invite contains the type |
10 | form of spam/access control. | 10 | of groupchat (text only, A/V) the friend is being invited to. |
11 | |||
12 | ## Joining the chats | ||
13 | 11 | ||
12 | TODO: write more of this. | ||
14 | 13 | ||
15 | ## Protocol | 14 | ## Protocol |
16 | 15 | ||
16 | Invite packets: | ||
17 | Invite 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 | |||
20 | Response 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 | |||
24 | Peer online packet: | ||
25 | [uint8_t id 97][uint16_t group chat number][33 bytes group chat identifier[1 byte type][32 bytes id]] | ||
26 | |||
27 | Peer leave packet: | ||
28 | [uint8_t id 98][uint16_t group chat number][uint8_t id 1] | ||
17 | 29 | ||
18 | Node format: | 30 | Peer query packet: |
19 | See DHT, currently uses the IPv6 Node_format. | 31 | [uint8_t id 98][uint16_t group chat number][uint8_t id 4] |
20 | 32 | ||
21 | Get nodes (Request): | 33 | Peer response packet: |
22 | Packet 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 | ``` | ||
26 | Valid replies: a send_nodes packet | ||
27 | 35 | ||
28 | Send_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 | ||
33 | Broadcast packet: | 37 | Message 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 | ||
40 | Lossy 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 | |||
43 | Group chat types: | ||
44 | 0: text | ||
45 | 1: AV | ||
38 | 46 | ||
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 | 47 | ||
43 | Note: the message number is increased by 1 for each sent message. | 48 | Note: the message number is increased by 1 for each sent message. |
44 | 49 | ||
@@ -49,14 +54,10 @@ No data. | |||
49 | 54 | ||
50 | 16 - new_peer | 55 | 16 - new_peer |
51 | Tell everyone about a new peer in the chat. | 56 | Tell 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 | |||
54 | 17 - ban_peer | ||
55 | Ban a peer | ||
56 | [uint8_t public_key[public_key_len]] | ||
57 | 58 | ||
58 | 18 - topic change | 59 | 17 - kill_peer |
59 | [uint8_t topic[topiclen]] | 60 | [uint16_t peer_num] |
60 | 61 | ||
61 | 48 - name change | 62 | 48 - name change |
62 | [uint8_t name[namelen]] | 63 | [uint8_t name[namelen]] |
@@ -69,3 +70,6 @@ Ban a peer | |||
69 | 70 | ||
70 | 65 - action (/me) | 71 | 65 - action (/me) |
71 | [uint8_t message[messagelen]] | 72 | [uint8_t message[messagelen]] |
73 | |||
74 | |||
75 | |||