/ PROTOCOL.md
PROTOCOL.md
 1  # Amnezichat Protocol
 2  
 3  ## Overview
 4  Amnezichat is a secure, privacy-focused messaging protocol designed to ensure that no logs are retained and that all message data is stored exclusively in the server's RAM. The protocol uses quantum-resistant cryptographic techniques to provide strong end-to-end encryption, forward secrecy, and defense against traffic analysis.
 5  
 6  ## Cryptographic Components
 7  - **Authentication:** EdDSA (Edwards-curve Digital Signature Algorithm) & Dilithium5 (Quantum-resistant)
 8  - **Key Exchange:** ECDH (Elliptic-curve Diffie-Hellman) & Kyber1024 (Quantum-resistant)
 9  - **Encryption:** ChaCha20-Poly1305 (Authenticated encryption)
10  - **Key Derivation Function (KDF):** Argon2id
11  - **Data Storage Protection:** Local identity keys are encrypted with ChaCha20-Poly1305 and secured using Argon2id with a user-specified password.
12  
13  ## Hybrid Key Exchange Diagram:
14  
15  ![hybrid_key_exchange](hybrid_key_exchange.png)
16  
17  ## Protocol Design
18  ### 1. Session Establishment
19  - Clients initiate a session by generating ephemeral key pairs.
20  - A key exchange is performed using ECDH and Kyber1024 to derive a shared secret.
21  - Both parties authenticate using EdDSA and Dilithium5 signatures.
22  - A session key is derived from the shared secret using a cryptographic hash function.
23  
24  ### 2. Secure Messaging
25  - Each message is encrypted using ChaCha20-Poly1305 with the session key.
26  - Forward and backward secrecy is ensured by generating new ephemeral keys periodically.
27  - Messages are padded to a fixed length to mitigate traffic analysis attacks.
28  - To resist AI-guided Traffic Analysis (DAITA), encrypted dummy data is sent at random intervals.
29  
30  ### 3. Group Messaging
31  - Pre-Shared Key (PSK) derived from a room password using Argon2id is used to encrypt group messages.
32  - Each participant in a group shares a common PSK for message encryption.
33  
34  ### 4. Data Retention Policy
35  - Messages are stored only in RAM and wiped automatically after 24 hours.
36  - No persistent logs or metadata are retained by the server.
37  - Server resets result in complete data erasure.
38  
39  ## Network Layer
40  - All traffic is routed over Tor/I2P network by default to provide anonymity.
41  - Onion/Garlic routing ensures that IP addresses remain hidden.
42  - Messages are encapsulated in encrypted packets with randomized timing to prevent correlation attacks.
43  
44  ## Security Considerations
45  - Users must ensure their local devices are secure to prevent key theft.
46  - Strong passwords should be used for encrypting identity keys.
47  
48  ## License
49  Amnezichat is distributed under the GPLv3 License. See `LICENSE` for more information.
50  
51  ## Support & Donations
52  To support development, consider donating:
53  - **Monero (XMR):** 88a68f2oEPdiHiPTmCc3ap5CmXsPc33kXJoWVCZMPTgWFoAhhuicJLufdF1zcbaXhrL3sXaXcyjaTaTtcG1CskB4Jc9yyLV
54  - **Bitcoin (BTC):** bc1qn42pv68l6erl7vsh3ay00z8j0qvg3jrg2fnqv9
55