Skip to content

About

Digital Twin and IoT monitoring system for a simulated smart cold-storage cooling unit.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

SecureChat

🔐 Secure AI-Powered Messaging Platform

SecureChat is a modern Flask-based communication platform designed around three core principles:

  • 🔐 Security
  • 🤖 Intelligence
  • 🔎 Transparency

The project combines secure authentication, encrypted messaging, AI assistance, real-time communication, and a visual encryption inspector into a single web application.

✨ Features

🔐 Secure Authentication

  • Google OAuth 2.0 authentication
  • Secure Flask session management
  • Environment-based configuration for sensitive credentials
  • Authentication handled through Authlib

🔒 Secure Message Encryption

  • Symmetric message encryption using the Python cryptography library
  • Fernet-based authenticated encryption
  • Randomized encryption for each message
  • Encrypted communication designed to protect message contents

🤖 AI Assistant

  • Google Gemini AI integration
  • Dedicated AI chat mode
  • Real-time interaction with the AI assistant
  • Error handling for API limitations and failures

💬 Real-Time Communication

  • Direct personal chat functionality
  • Real-time communication using Flask-SocketIO
  • Users can start a secure conversation using a peer's username or ID
  • Dedicated interface for switching between personal chat and AI mode

🔎 Encryption Inspector

  • Displays plaintext and encrypted ciphertext
  • Provides a visual demonstration of the encryption process
  • Allows users to inspect encryption while composing messages
  • Toggleable inspector interface

🎨 Modern User Interface

  • Dark-mode interface
  • Glassmorphism-inspired design
  • Animated WebGL background
  • Responsive layout
  • Smooth transitions and interactive elements

🛠️ Tech Stack

Component Technology
Backend Python, Flask
Real-Time Communication Flask-SocketIO
Frontend HTML5, CSS3, JavaScript
Encryption Python Cryptography / Fernet
Authentication Authlib, Google OAuth 2.0
AI Integration Google Gemini
Configuration Python-dotenv
Logging Python Logging

🏗️ System Architecture

The application follows a modular Flask architecture.

User Interface

↓

Flask Application

↓

Authentication / Chat / AI / Encryption Modules

↓

Encrypted Communication & Real-Time Socket Communication

The major components are separated into dedicated Python modules for authentication, encryption, AI processing, logging, and application control.

📁 Project Structure

SecureChat/
├── app.py
├── auth.py
├── encryption.py
├── ai_handler.py
├── logger.py
├── requirements.txt
├── FINAL_PROJECT_REPORT.md
├── static/
│   ├── style.css
│   └── shader.js
├── templates/
│   ├── index.html
│   └── login.html
└── .gitignore

File Description

File Purpose
app.py Main Flask application and application routes
auth.py Authentication and Google OAuth functionality
encryption.py Message encryption and decryption functionality
ai_handler.py Google Gemini AI integration
logger.py Application logging functionality
requirements.txt Python dependencies
FINAL_PROJECT_REPORT.md Detailed project report
static/style.css Application styling and UI design
static/shader.js Animated WebGL background
templates/index.html Main chat interface
templates/login.html Login interface
.gitignore Prevents sensitive and unnecessary files from being committed

🔐 Security

Security is one of the main design principles of SecureChat.

Sensitive credentials and local configuration files are excluded from version control using .gitignore.

The project excludes:

  • .env files
  • Encryption keys
  • API credentials
  • OAuth secrets
  • Virtual environments
  • Local logs
  • Python cache files
  • IDE-specific files

Never commit API keys, OAuth client secrets, encryption keys, or other sensitive credentials to GitHub.

Security Practices

  • OAuth 2.0 authentication through Google
  • Environment-based secret management
  • Authenticated message encryption using Fernet
  • Separation of security functionality into dedicated modules
  • Secure session configuration
  • Application logging

🤖 AI Integration

SecureChat includes a dedicated AI communication mode powered by Google Gemini.

Users can switch from personal communication to AI-assisted communication through the application's AI interface.

The AI functionality is separated into ai_handler.py, allowing AI-related processing to remain independent from the main application logic.

🔎 Encryption Transparency

SecureChat includes an Encryption Inspector to make the encryption process visible to the user.

The inspector provides a visual representation of:

Plaintext Message → Encrypted Ciphertext

This feature demonstrates how readable message content is transformed by the encryption layer before being handled by the secure communication system.

🎯 Project Purpose

SecureChat was developed as a security-focused modernization project.

The goal was to transform a basic Flask-based chat application into a more secure, intelligent, and transparent communication platform.

The project demonstrates practical implementation of:

  • Authentication
  • Encryption
  • Secure configuration
  • Real-time communication
  • AI integration
  • Security logging
  • Modular application design
  • Security transparency
  • Modern web interface development

🚀 Running Locally

1. Clone the Repository

git clone https://github.com/Mannat29/securechat.git
cd securechat

2. Create a Virtual Environment

On Windows:

python -m venv .venv

Activate the virtual environment:

.venv\Scripts\activate

3. Install Dependencies

pip install -r requirements.txt

4. Configure Environment Variables

Create a .env file in the project directory and configure the required credentials.

Example:

GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GEMINI_API_KEY=your_gemini_api_key
SECRET_KEY=your_secret_key

Do not commit the .env file or any credentials to GitHub.

5. Run the Application

python app.py

The application will start using the Flask development server.

Open the local address displayed in the terminal to access SecureChat.

⚙️ Configuration

SecureChat uses environment variables to keep sensitive configuration separate from the source code.

Typical configuration includes:

  • Google OAuth Client ID
  • Google OAuth Client Secret
  • Gemini API Key
  • Flask Secret Key
  • Encryption-related configuration

The actual values should remain local and must not be committed to the repository.

🧪 Educational Use

SecureChat is primarily an educational and demonstration project developed to explore practical security concepts in a web application.

It demonstrates how multiple security mechanisms can be combined within a Flask application while maintaining a modern user experience.

⚠️ Security Considerations

This project is intended primarily for educational and demonstration purposes and should not be considered production-ready without additional security hardening.

For production deployment, additional controls should include:

  • HTTPS/TLS
  • Secure production secret management
  • Production-grade OAuth configuration
  • Secure cookie configuration
  • CSRF protection
  • Rate limiting
  • Strong input validation
  • Production-grade logging and monitoring
  • Proper authorization and access control
  • Secure database/storage configuration
  • Production server configuration
  • Dependency and vulnerability management

📄 Project Report

A detailed project report describing the project overview, implemented features, technical architecture, security mechanisms, and design is available in:

FINAL_PROJECT_REPORT.md

👤 Author

Mannat Tomar

BCA (Hons.) Data Science
Minor in Cybersecurity

About

Digital Twin and IoT monitoring system for a simulated smart cold-storage cooling unit.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages