Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

messagingApp

Instant Messaging Web Application

This is an instant chat application built with Flask and Flask-SocketIO for real-time communication. It now features true end-to-end encryption (E2EE) for both messages and file attachments, ensuring that only chat participants can read the contents. All encryption and decryption are performed on the client side using AES-256, and the server only relays encrypted payloads without access to any plaintext data.

Below is a detailed explanation of the E2EE implementation and a summary of recent changes.

Features

  • True End-to-End Encryption (E2EE): All messages and file attachments are encrypted and decrypted on the client. The server never sees unencrypted content.
  • Real-Time Messaging: Exchange messages instantly with other users in the same chat room.
  • File and Photo Attachments: Send and preview images, videos, PDFs, documents, and more, all end-to-end encrypted.
  • Emoji Keyboard Support: Easily insert emojis into your messages using a modern emoji picker.
  • Modern UI: Improved aesthetics with avatars, dark mode, animated typing indicators, and banners for join/leave events.
  • Session Management: Join or leave chat rooms and view announcements for these actions.

End-to-End Encryption (E2EE) Details

How E2EE Works in This App

  • Client-Side Encryption: Before sending, all messages and files are encrypted in the browser using AES-256 (CBC mode, PKCS7 padding). The encryption key and IV are generated per session and never leave the client.
  • Server as Relay Only: The server receives only encrypted data and relays it to other clients. It cannot decrypt or read any message or file contents.
  • Client-Side Decryption: Recipients decrypt messages and files in their browser using the shared key and IV. No plaintext is ever exposed to the server.

Technical Details

  • Algorithm: AES-256 (CBC mode, PKCS7 padding)
  • Key Management: Keys and IVs are generated on the client and shared securely between participants (implementation may use a secure out-of-band method or session-based sharing).
  • Supported Data: Text messages, images, videos, PDFs, documents, spreadsheets, and more are all encrypted end-to-end.

Getting Started

Follow these steps to set up and run the application locally:

Requirements

  • Python 3.8 or higher
  • Node.js 14 or higher
  • Flask 3.0.3
  • Flask-SocketIO 5.3.2
  • python-socketio 5.7.2
  • python-engineio 4.6.0
  • cryptography 42.0.8

1. Clone the Repository

git clone https://github.com/knached99/messagingApp.git

2. Navigate to the Project Directory

cd messagingApp

3. Set Up a Virtual Environment

For Windows:

python -m venv venv
.\venv\Scripts\activate.ps1

For Linux/Mac:

python3 -m venv venv
source venv/bin/activate

4. Install Dependencies

First, install the JavaScript dependencies by running

npm install 

After that, navigate to the chat directory and install the required Python packages:

cd chat
pip install -r requirements.txt

5. Run the Application

Start the Flask server:

python app.py

6. Accessing the Application

Open your browser and go to http://localhost:5000.

7. Using the Application

Enter Username and Room Number: In the browser, input your desired username and room number to start a chat session. Join from Another Tab: Open a new tab or browser window, enter a different username but the same room number to join the same chat room. Configuration Secret Key: The application uses a dynamically generated secret key for message encryption. Ensure to handle this key securely.

Release Notes

Previous Version

  • Messages were encrypted, but encryption/decryption could occur on the server, meaning the server could potentially access plaintext data.
  • No support for file or photo attachments.
  • Basic UI with limited styling and no emoji keyboard.
  • No animated typing indicator or join/leave banners.

Current Version

  • True E2EE: All messages and files are encrypted/decrypted only on the client. The server never sees unencrypted content.
  • File/Photo Attachments: Send and preview images, videos, PDFs, and documents, all end-to-end encrypted.
  • Emoji Keyboard: Integrated emoji picker for easy emoji input.
  • Modern UI: Avatars, dark mode, animated typing indicator, join/leave banners, and improved aesthetics.
  • Refresh Confirmation: Warns users before leaving the chat to prevent accidental loss of messages.
  • Bug Fixes: Improved emoji picker reliability, robust event handling, and UI enhancements.

For any issues or feature requests, please open an issue on the GitHub repository.

About

Encrypted messaging web application

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages