r/foss • u/No_Ad_6261 • 17d ago
SecureP2PChat – Open-source, cross-platform E2EE messaging app built from scratch in Python & Kotlin (Tor-routed, X25519, FS2/TreeKEM)
Hi everyone!
I would like to introduce a personal project I have been working on for some time: SecureP2PChat, a private messaging application built with a focus on security, privacy, and cross-platform communication.
The project started from a simple idea: how much can be built independently, without relying on the infrastructure of commercial messaging platforms?
Currently, the project consists of two main components: a Desktop client built in Python and an Android client built in Kotlin. Both applications use a unified protocol and can communicate seamlessly with each other.
Technical Overview
The architecture is built around several core components:
Cryptography and Communication Security
X25519 for cryptographic key exchange.
Ed25519 for digital signatures and message verification.
Argon2id for key derivation from the user's password.
ChaCha20-Poly1305 for authenticated data encryption.
HKDF-SHA256 for key derivation.
FS2 for cryptographic chains and key rotation of individual messages.
GSK1 for managing sender keys in group conversations.
TreeKEM / MLS for group key management architecture.
Communications and Infrastructure
The application uses a hybrid communication architecture designed to allow both direct P2P connections and communication via a signaling and relay server when a direct connection is not possible.
The signaling server handles the exchange of information required to connect clients, while traffic routed through the relay infrastructure is protected by cryptographic mechanisms. TLS can be used for transport to the server, and Tor integration provides an additional routing layer for communications.
A key objective is ensuring that the server has zero access to the content of end-to-end encrypted messages.
Storage and Multimedia
The application includes a cryptographically protected local SQLite database, a file vault, and support for voice messages, images, and file transfers.
I also focused on preserving conversation states and the cryptographic material required for operation after restarting the application.
Why I Chose to Build This Project
I didn't just want to build another chat app. I wanted to understand and implement a complete system where cryptography, data transport, relay infrastructure, and client applications work together.
The most interesting challenge was interoperability between Windows and Android, as I had to maintain full compatibility of the protocol and cryptographic mechanisms across two different technology stacks.
I have tested communication between Desktop and Android, including routing via the relay over Tor. I am currently continuing to test and verify P2P connections and file transfers.
The project is still under active development, and I am not presenting it as a certified or independently audited solution. I believe security must be proven through testing, verification, and auditing, not simply by listing the algorithms used.
Repository and Source Code
GitHub – SecureP2PChat Desktop: https://github.com/andromeda-rt/SecureP2PChat-Desktop
GitHub – My Profile: https://github.com/andromeda-rt
I would love to hear your thoughts, especially from those with experience in Python, Kotlin, applied cryptography, communication protocols, and information security.
I am looking for technical feedback, suggestions for improvement, and any potential architectural flaws you might spot.
Thank you!