Skip to content
holy-cursorPublic

About

an onchain messaging app

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

70 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” GMChat - Secure P2P Messaging App

GMChat is a decentralized, end-to-end encrypted messaging application built with React, WebSocket relay, and IPFS storage. Features enterprise-grade security with ECDH key exchange and zero-knowledge architecture.

✨ Features

  • πŸ” End-to-End Encryption: AES-256-GCM with unique keys per conversation
  • πŸ”‘ Secure Key Exchange: ECDH P-256 for cryptographic key derivation
  • 🌐 Decentralized Storage: IPFS for censorship-resistant message storage
  • πŸ“‘ P2P Messaging: WebSocket relay for real-time communication
  • πŸ’Ό Wallet Integration: MetaMask, WalletConnect, Coinbase Wallet
  • πŸ›‘οΈ Enterprise Security: API keys protected in backend, no client exposure
  • πŸ“± Responsive Design: Works on desktop and mobile devices

πŸš€ Live Demo

Deploy with Vercel

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Client App    β”‚    β”‚  Backend API    β”‚    β”‚   IPFS Network  β”‚
β”‚                 β”‚    β”‚                 β”‚    β”‚                 β”‚
β”‚ β€’ ECDH Keys     │◄──►│ β€’ API Protection│◄──►│ β€’ Pinata Gatewayβ”‚
β”‚ β€’ AES-256-GCM   β”‚    β”‚ β€’ Environment   β”‚    β”‚ β€’ Decentralized β”‚
β”‚ β€’ WebSocket     β”‚    β”‚ β€’ Rate Limiting β”‚    β”‚ β€’ Permanent     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ WebSocket Relay β”‚
β”‚                 β”‚
β”‚ β€’ Real-time     β”‚
β”‚ β€’ P2P Messaging β”‚
β”‚ β€’ Message Queue β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”§ Tech Stack

  • Frontend: React, TypeScript, Tailwind CSS
  • Backend: Node.js, Express, Vercel API Routes
  • Encryption: Web Crypto API, ECDH, AES-GCM
  • Storage: IPFS via Pinata
  • Messaging: WebSocket relay server
  • Wallets: Wagmi, RainbowKit
  • Deployment: Vercel

πŸ›‘οΈ Security Features

βœ… Implemented Security Measures

  1. API Key Protection

    • Backend proxy prevents client-side exposure
    • Environment variables secured on server
    • No sensitive data in client code
  2. Cryptographic Security

    • ECDH P-256 for key exchange
    • AES-256-GCM for message encryption
    • Unique keys per conversation
    • ECDSA signatures for message integrity
  3. Privacy Protection

    • No metadata stored in IPFS
    • Encrypted content only
    • Sanitized logging
    • Zero-knowledge architecture
  4. Network Security

    • WebSocket relay for P2P communication
    • CORS protection
    • Rate limiting ready
    • HTTPS enforcement

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • npm or yarn
  • Git

1. Clone Repository

git clone https://github.com/YOUR_USERNAME/p2p-messaging-app.git
cd p2p-messaging-app

2. Install Dependencies

npm install

3. Configure Environment

# Copy environment template
cp env.example .env

# Edit .env with your values
REACT_APP_BACKEND_URL=/api

4. Start Development

# Start all services
npm run dev

# Or start individually
npm run backend  # Backend API
npm run relay    # WebSocket relay
npm start        # Frontend app

5. Open Application

🌐 Deployment

Deploy to Vercel

  1. Fork this repository
  2. Connect to Vercel
  3. Set environment variables:
    PINATA_API_KEY=your_pinata_api_key
    PINATA_SECRET_KEY=your_pinata_secret_key
    REACT_APP_BACKEND_URL=/api
    
  4. Deploy!

Deploy with Vercel

Manual Deployment

# Build for production
npm run build

# Deploy to your preferred platform
# The build folder contains the static files

πŸ”‘ Environment Variables

Required for IPFS (Backend)

PINATA_API_KEY=your_pinata_api_key
PINATA_SECRET_KEY=your_pinata_secret_key

Optional (Frontend)

REACT_APP_BACKEND_URL=/api
REACT_APP_ALCHEMY_API_KEY=your_alchemy_key
REACT_APP_WALLETCONNECT_PROJECT_ID=your_project_id

πŸ“± Usage

  1. Connect Wallet: Use MetaMask, WalletConnect, or Coinbase Wallet
  2. Add Contacts: Enter wallet addresses of people you want to message
  3. Send Messages: Type and send encrypted messages
  4. Real-time: Messages appear instantly via WebSocket relay
  5. Permanent Storage: Messages stored on IPFS for offline access

πŸ”’ Security Considerations

For Production Use:

  • βœ… Use HTTPS for all connections
  • βœ… Implement rate limiting
  • βœ… Add user authentication if needed
  • βœ… Monitor for suspicious activity
  • βœ… Regular security audits
  • βœ… Key rotation policies

Current Security Level:

  • 🟒 Production Ready: Enterprise-grade security implemented
  • 🟒 API Protection: Keys never exposed to client
  • 🟒 Encryption: Military-grade AES-256-GCM
  • 🟒 Privacy: Zero-knowledge architecture

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

πŸ“„ License

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

πŸ™ Acknowledgments

πŸ“ž Support


Built with ❀️ for a decentralized future 🌐

About

an onchain messaging app

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages