Skip to content

Commit c07e893

Browse files
authored
Protocol explanation
1 parent eb64623 commit c07e893

1 file changed

Lines changed: 66 additions & 1 deletion

File tree

docs/protocol/index.md

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,69 @@ nav_order: 2
55

66
# Protocol
77

8-
Information about the Parley protocol.
8+
Information about the Parley protocol.
9+
10+
## Accounts
11+
12+
Accounts have 3 values: public/private keypair (Supported: `RSA-OAEP`, label: `parley`) and a passkey\
13+
The server must only store the public and an encrypted version of the passkey, never receiving the private key.\
14+
Public/Private key pair must be generated by the client and passkey by the server.\
15+
The server should verify the client with both the passkey and by decrypting a value encrypted with the public key.
16+
17+
Flow:
18+
```
19+
Client Server
20+
| |
21+
| Keypait creation |
22+
| /signup -------------> |
23+
| | Challenge value encrypted
24+
| <----------- Challenge |
25+
| Decryption |
26+
| /challenge ----------> |
27+
| | Verify & Paskey creation
28+
| <--- Passkey & Session |
29+
| |
30+
```
31+
32+
## Messages
33+
34+
The users keypairs are used for asymmetric key encryption to pass an ephemeral shared key (Supported: `AES-GCM`) to allow symmetric key encryption of messages.\
35+
Shared keys should expire after an hour for foward secrecy, this prevents compromised keys from leaking the entire chat.\
36+
If expired: The next person to send a message must generate a new shared key and encrypt it with each member's public key.\
37+
Messages additionally are signed with the user's private key as `RSA-PSS` with a salt length of `222` (Signature format: `${message_content}:${channel_id}:${unix_s}`).\
38+
To send the message it requires the shared key which needs the user's public key to encrypt, and to sign it, the private key.\
39+
This prevents MitM attacks since changing the public key of a member to be able to read messages would either invalidate the signature or decryption.
40+
41+
Flow:
42+
```
43+
**Read:**
44+
Client Server
45+
| |
46+
| /messages -----------> |
47+
| <------------ Messages |
48+
| /key ----------------> |
49+
| <-------- Specific key |
50+
| Decrypt shared |
51+
| Decrypt message |
52+
| Verify message |
53+
| |
54+
**Send:**
55+
Client Server
56+
| |
57+
| /key ----------------> |
58+
| <------------ Last key |
59+
| |
60+
If expired:
61+
| |
62+
| Generate AES key |
63+
| Encrypt for each |
64+
| /keys ---------------> |
65+
| | Save encrypted keys
66+
| |
67+
Finally:
68+
| |
69+
| Encrypt message |
70+
| Sign message |
71+
| /message ------------> |
72+
| |
73+
```

0 commit comments

Comments
 (0)