Secure end-to-end encrypted chat software
π Project Website: https://kaleidotalk.hanbangze.tech
π Read the Manifesto: MANIFESTO.md β Privacy is a human right.
KaleidoTalk is an end-to-end encrypted chat application that uses Ed25519 identity keys and X25519 key exchange to ensure that only message participants can read message content.
New in v3.0: X25519 key rotation, irreversible account freeze, modern bubble UI, server configuration file, and client config persistence.
Before using or deploying this software, please read the full Compliance Statement and Disclaimer.
Quick reminder: KaleidoTalk is an open-source learning project. If you deploy it on the public internet, you are responsible for complying with local law.
- End-to-end encryption: Ed25519 + X25519 + AES-256-GCM, only sender and receiver can decrypt
- Forward secrecy: each message uses an ephemeral X25519 key pair, so long-term key compromise does not expose historical messages
- Key rotation (v3.0): X25519 keys are automatically rotated every 24 hours, limiting the impact of private key leakage to a narrow time window
- Irreversible account freeze (v3.0): generate a recovery certificate during registration; if your account is compromised, you can permanently freeze it β no one, not even the server admin, can unfreeze it
- Dual private-key storage modes: encrypted server-side key storage (multi-device login) or local-only key storage
- User trust verification: identity fingerprint validation via SHA-256 public key hash, with BIP39 word display (6 English words) for human verification
- TLS 1.2+ transport encryption: self-signed certificates + TOFU trust model, first-connection certificate fingerprint verification via BIP39 words
- Cover traffic:
- All packets are fixed to 2048 bytes, with random padding
- Heartbeat packets are sent at random intervals (3.3β6.7 seconds)
- Helps resist traffic analysis based on packet length and timing
- Offline message queue: users receive offline messages automatically after login
- IP/User bans: admins can ban malicious IPs or users, with temporary/permanent options
- DoS protection: registration/login rate limiting with automatic IP banning
- Invite-code registration: optional invite mechanism to restrict open registration
- Server configuration file:
config.jsonfor easy setup of host, port, security parameters, and more
- Modern bubble chat UI: left contact list with avatars, unread badges, trust indicators; right chat area with message bubbles (own messages in blue, others with avatars)
- Responsive design: adapts to screen resolution
- System tray & message flashing: stays unobtrusive while keeping you notified
- Dark theme by default
| Component | Algorithm | Purpose |
|---|---|---|
| Identity key | Ed25519 | Digital signatures and sender authenticity |
| Key exchange | X25519 | ECDH shared-secret negotiation |
| Symmetric encryption | AES-256-GCM | Message encryption with authentication |
| Key derivation | HKDF-SHA256 | Derive AES key and nonce from ECDH secret |
| Password storage | PBKDF2-SHA256 (600k iterations) | Server-side password hash storage |
| Transport encryption | TLS 1.2+ (RSA 2048) | Protect client-server communication (self-signed cert) |
Message encryption flow:
- Sender generates an ephemeral X25519 key pair
- ECDH with recipient's public key (using the latest X25519 key from the recipient's key list) to derive a shared secret
- HKDF derives AES key and nonce
- Encrypt message with AES-256-GCM, including the
key_idof the sender's key used (for rotation compatibility) - Sender signs (ephemeral public key + ciphertext + tag) with Ed25519
- Recipient verifies signature, extracts
key_id, finds the corresponding private key, and decrypts
- Python 3.8+
- Dependencies:
cryptography,pystray,Pillow,customtkinter
Using a virtual environment is recommended:
pip install -r requirements.txtOr install directly:
pip install cryptography pystray Pillow customtkinterpython run_server.pyOn first start, you must set an admin password to protect server private keys.
After startup, TLS certificate and key files are generated under server_keys/.
You can customize server behavior by editing config.json (created automatically).
python run_client.pyClient configuration (server address, window size, theme, auto-connect) is persisted in local_keys/client_config.json.
- Connect to server: Click "Connect" and enter server address (default
127.0.0.1:5555)- On first connection, the client shows 6 BIP39 words for the server TLS certificate fingerprint. Verify through a secure channel (phone/in person), then trust.
- Register account: Click "Register" and set username (3-20 alphanumeric) and password (at least 8 chars including letters and digits)
- Choose private-key storage mode: server-hosted (cross-device) or local-only.
- Important: A recovery key is generated and saved locally (
local_keys/<username>_recovery.priv). Keep it safe β it allows you to permanently freeze your account if compromised.
- Login: Sign in with the registered username and password.
- Send messages: Double-click an online user, type a message, and send.
When chatting with a new contact for the first time, verify the peer fingerprint (also shown as 6 BIP39 words) through a secure channel. After successful verification, decryption is automatic in future chats.
admin.py provides local server administration (direct file edits; server runtime not required):
# Invite code management
python admin.py invites add --count 5 --uses 1 --length 8
python admin.py invites delete CODE123
python admin.py invites set-require true
python admin.py invites list
# Ban management
python admin.py ban ip 1.2.3.4 --duration 3600
python admin.py ban user alice
python admin.py unban ip 1.2.3.4
python admin.py unban user alice
python admin.py list-bans
# User management
python admin.py users list
python admin.py users delete aliceIf you lose access to your account (e.g., forgotten password or stolen credentials), you can permanently freeze it using the recovery key:
python freeze_account.py --server 127.0.0.1:5555 --username alice --recovery-key local_keys/alice_recovery.privThis action is irreversible. The account will be permanently locked and cannot be logged in again.
KaleidoTalk/
βββ run_client.py # Client entrypoint
βββ run_server.py # Server entrypoint
βββ admin.py # Admin CLI script (root)
βββ freeze_account.py # Standalone account freeze tool
βββ reset.bat # Windows reset script (wipes runtime data)
βββ src/
β βββ client/ # Client logic and GUI
β β βββ chat_client.py
β β βββ chat_gui.py
β βββ server/ # Server core
β β βββ config.py # Server configuration loader
β β βββ server.py
β β βββ server_commands.py
β β βββ server_session.py
β β βββ server_storage.py
β βββ common/ # Shared modules
β βββ crypto_utils.py
β βββ network.py
β βββ padding.py
βββ test/ # Smoke and integration tests
β βββ test_key_rotation_smoke.py
β βββ test_e2e_rotation.py
β βββ test_freeze_smoke.py
β βββ test_freeze_e2e.py
βββ docs/ # Website HTML
βββ licenses/ # Third-party license texts
βββ .github/workflows/ # CI configuration
βββ requirements.txt
βββ README.md
βββ LICENSE
βββ COMPLIANCE.md
βββ DISCLAIMER.md
βββ MANIFESTO.md
βββ CONTRIBUTING.md
βββ CODE_OF_CONDUCT.md
βββ SECURITY.md
βββ .gitignore
Runtime-generated data files (default server working directory):
| File/Directory | Description |
|---|---|
users.json |
User password hashes (hosted-key mode) |
user_keys.json |
User public keys, encrypted private keys, and rotation data |
invite_codes.json |
Invite-code configuration |
bans.json |
IP/User ban records |
server.log |
Server logs |
config.json |
Server configuration (host, port, security params, etc.) |
local_keys/ |
Client local key storage (trust store, private keys, recovery keys, config) |
server_keys/ |
Server key storage (TLS cert, Ed25519/X25519 private keys) |
- Protocol: custom fixed-size packet protocol (2048 bytes), supports fragmentation reassembly, random padding, and heartbeat cover traffic
- Transport encryption: TLS 1.2+ (self-signed certificates, TOFU trust)
- Session management: HMAC auth + sequence/timestamp anti-replay, supports single-session login
- Concurrency model: multi-threaded server, one thread per client
- Storage: JSON-based storage (extendable to database)
- Key rotation: automatic 24βhour cycle; server stores multiple key versions for smooth transitions
Issues and Pull Requests are welcome. Please read CONTRIBUTING.md and CODE_OF_CONDUCT.md first.
This software is for educational and lawful use only. Users must comply with local law. The author is not responsible for unlawful use. See DISCLAIMER.md for full terms.
KaleidoTalk is free software licensed under the GNU General Public License v3.0. See LICENSE for details.
Third-party libraries used:
- cryptography β Cryptographic primitives (Apache 2.0)
- pystray β System tray support (LGPLv3)
- Pillow β Image processing (MIT derivative)
- CustomTkinter β GUI framework (MIT)
- Submit an Issue
- Website: https://kaleidotalk.hanbangze.tech
Built with love by Bangze Han