SecureChat is a real-time, end-to-end encrypted chat application designed for secure, private communication. It allows users to exchange messages, images, and emojis with friends, offering features like Two-Factor Authentication (2FA) and a unique, editable message ID (ms_id) for friend requests.
- End-to-End Encryption (E2EE): Messages and media are encrypted on the client-side using public/private key cryptography, ensuring only the sender and recipient can read them.
- Friend System: Users can only chat with accepted friends, using an editable ms_id for requests.
- Private Message ID (ms_id): A unique identifier for each user, allowing for secure friend requests.
- 2FA: Two-factor authentication using TOTP (via authenticator apps) or email-based verification.
- Encrypted Image Sharing: Users can securely share images, which are encrypted and only accessible to friends.
- Emoji Support: Users can send emojis during chats.
- FastAPI: Python framework for handling APIs and real-time messaging.
- PostgreSQL/MySQL: Database for user data, encrypted messages, and TOTP secrets.
- PyOTP: Library for generating and verifying 2FA codes.
- Cryptography Libraries: For encryption of messages and files.
- React/Vue.js: Dynamic frontend for chat functionality.
- Web Crypto API: Client-side encryption and decryption of messages.
- Cloudflare: CDN for performance and security.
- Free Hosting Platforms: Backend deployed on a free hosting platform (e.g., Heroku or Vercel).
- Python 3.x
- Node.js and npm (for frontend)
- PostgreSQL or MySQL
-
Clone the repository:
git clone https://github.com/your-repo/securechat.git cd securechat -
Install the dependencies:
pip install -r requirements.txt
-
Set up the database:
- Create a PostgreSQL or MySQL database.
- Update the
.envfile with your database URL.
-
Run the server:
uvicorn main:app --reload
-
Navigate to the frontend directory:
cd frontend -
Install frontend dependencies:
npm install
-
Run the frontend:
npm run serve
To run backend tests:
pytestCreate a .env file with the following environment variables:
DATABASE_URL=postgresql://user:password@localhost/dbname
SECRET_KEY=your_secret_keysecurechat/
├── backend/
│ ├── app/
│ ├── tests/
│ └── main.py
├── frontend/
│ ├── public/
│ ├── src/
│ └── main.js
└── README.md
- End-to-End Encryption (E2EE) for all messages and files.
- TOTP-based 2FA for added account security.
- Editable ms_id for secure
friend management.
Licensed under the MIT License.