Skip to content

Vixcy300/e2e-encrypted-messenger

Repository files navigation

SecureP2P Logo

πŸ” SecureP2P Messenger

End-to-End Encrypted β€’ Peer-to-Peer β€’ Zero Knowledge

Author Project Type

Next.js TypeScript Socket.IO Tailwind License

Encryption Key Derivation Protocol


Demo


🌟 Overview

SecureP2P Messenger is a cutting-edge, end-to-end encrypted messaging application built as a capstone project. It demonstrates advanced secure communication technologies, ensuring that your messages remain private and can only be read by you and your intended recipient.

πŸ”’ True E2E Encryption

Messages are encrypted on your device using AES-256-GCM before being transmitted. The server cannot read your messages - it only relays encrypted data.

🌐 Works Offline

Connect via mobile hotspot without internet! Perfect for private communication in areas with limited connectivity.

⚑ Real-time Communication

Instant messaging with typing indicators, read receipts, and live connection status using WebSocket technology.

πŸ“ Secure File Transfer

Share files of any type with the same military-grade encryption. Files are chunked and encrypted before transfer.


✨ Features

πŸ” Security Features
Feature Description
AES-256-GCM Military-grade symmetric encryption
PBKDF2 100,000 iterations for key derivation
Unique IV Each message uses a unique initialization vector
Zero-Knowledge Server cannot decrypt messages
Bcrypt Hashing Secure password storage
JWT Authentication Secure session management
πŸ’¬ Messaging Features
Feature Description
Real-time Chat Instant message delivery
Typing Indicators See when peer is typing
Message Status Sent, delivered, read receipts
Room Codes Easy 6-character room codes
QR Code Sharing Scan to join rooms
Emoji Support Full emoji picker
πŸ“ File Transfer
Feature Description
Any File Type Support for all formats
Chunked Transfer Reliable large file support
Progress Tracking Real-time progress bar
Encrypted Transfer E2E encrypted files
🎨 User Experience
Feature Description
Modern Dark UI Sleek cyberpunk design
Responsive Works on all devices
Animations Smooth Framer Motion transitions
Toast Notifications Clear user feedback
P2P Visualization Real-time network status

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        HOW IT WORKS                                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

     πŸ“± Device A                    πŸ–₯️ Server                    πŸ’» Device B
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚          β”‚                  β”‚          β”‚                  β”‚          β”‚
    β”‚  "Hello" β”‚                  β”‚  ??????  β”‚                  β”‚  "Hello" β”‚
    β”‚    ↓     β”‚                  β”‚    ↓     β”‚                  β”‚    ↑     β”‚
    β”‚ ENCRYPT  β”‚ ──────────────►  β”‚  RELAY   β”‚ ──────────────►  β”‚ DECRYPT  β”‚
    β”‚ AES-256  β”‚    Encrypted     β”‚  (Can't  β”‚    Encrypted     β”‚ AES-256  β”‚
    β”‚          β”‚    Gibberish     β”‚   Read)  β”‚    Gibberish     β”‚          β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     KEY DERIVATION                                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

    Room Code: "ABC123"  +  PeerID_A  +  PeerID_B
                              ↓
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚     PBKDF2      β”‚
                    β”‚ 100,000 rounds  β”‚
                    β”‚    SHA-256      β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             ↓
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   SAME KEY ON   β”‚
                    β”‚   BOTH DEVICES  β”‚  ← Never transmitted!
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quick Start

Prerequisites

Node.js >= 18.0
npm or yarn

Installation

# 1. Clone the repository
git clone https://github.com/Vixcy300/securep2p-messenger.git
cd securep2p-messenger

# 2. Install dependencies
npm install

# 3. Set up environment
cp .env.example .env.local

# 4. Start the servers
# Terminal 1:
node server/index.js

# Terminal 2:
npm run dev

# 5. Open in browser
# http://localhost:3000

Windows Quick Start

# Just double-click:
start.bat

πŸ“± Mobile / Hotspot Setup

Want to use on mobile or without internet? Easy!

# 1. Find your computer's IP
ipconfig  # Windows
ifconfig  # Mac/Linux

# 2. Update .env.local
NEXT_PUBLIC_SIGNALING_SERVER=http://YOUR_IP:3001
NEXT_PUBLIC_APP_URL=http://YOUR_IP:3000

# 3. Restart servers and access from mobile
http://YOUR_IP:3000

πŸ› οΈ Tech Stack

Next.js
Next.js 14
TypeScript
TypeScript
Tailwind
Tailwind
Node.js
Node.js
Socket.IO
Socket.IO

Full Stack Details

Layer Technology Purpose
Frontend Next.js 14, React 18 UI Framework
Styling Tailwind CSS, Framer Motion Design & Animations
State Zustand Global State Management
Backend Node.js, Express API Server
Real-time Socket.IO WebSocket Communication
Security Web Crypto API Browser-native Encryption
Auth JWT, Bcrypt Authentication

πŸ“ Project Structure

securep2p-messenger/
β”œβ”€β”€ πŸ“‚ app/                    # Next.js App Router
β”‚   β”œβ”€β”€ πŸ“„ layout.tsx         # Root layout
β”‚   β”œβ”€β”€ πŸ“„ page.tsx           # Main page
β”‚   └── πŸ“„ globals.css        # Global styles
β”œβ”€β”€ πŸ“‚ components/            # React components
β”‚   β”œβ”€β”€ πŸ“„ chat-interface.tsx # Chat UI
β”‚   β”œβ”€β”€ πŸ“„ disclaimer.tsx     # Attribution (protected)
β”‚   β”œβ”€β”€ πŸ“„ dashboard.tsx      # Main dashboard
β”‚   └── πŸ“‚ ui/               # Reusable components
β”œβ”€β”€ πŸ“‚ lib/                   # Core utilities
β”‚   β”œβ”€β”€ πŸ“„ crypto.ts         # Encryption functions
β”‚   β”œβ”€β”€ πŸ“„ p2p.ts            # P2P connection logic
β”‚   β”œβ”€β”€ πŸ“„ store.ts          # Zustand state
β”‚   └── πŸ“„ utils.ts          # Helpers
β”œβ”€β”€ πŸ“‚ server/               # Backend
β”‚   └── πŸ“„ index.js          # Express + Socket.IO
└── πŸ“‚ public/               # Static assets

πŸ”’ Security Details

Encryption Flow

Message Input β†’ UTF-8 Encode β†’ AES-256-GCM Encrypt β†’ Base64 β†’ Transmit
                                      ↑
                               Random 12-byte IV
                                      +
                            PBKDF2 Derived Key

What's Protected

βœ… Protected ❌ Visible to Server
Message content Message timestamps
File contents Room codes
Encryption keys Connection status

πŸ‘¨β€πŸ’» Author

Vignesh

GitHub

Capstone Project β€’ 2025


πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

⚠️ Attribution Required: The disclaimer component must remain intact when using or distributing this project.


πŸ™ Acknowledgments


⭐ If you found this project helpful, please give it a star!

Made with ❀️ and β˜• by Vignesh

About

πŸ”’ End-to-end encrypted P2P messenger with secure file transfer, WebRTC connections, and real-time chat. Built with Next.js, Socket.IO & AES-256-GCM encryption.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages