Skip to content

Repository files navigation

SecureCrypt - Text Encryption & Decryption App

A mobile-first, responsive web application for secure text encryption and decryption using AES-256-GCM encryption.

SecureCrypt Next.js Tailwind

✨ Features

  • Military-grade Encryption: AES-256-GCM with PBKDF2 key derivation
  • Mobile-first Design: Touch-friendly UI that works on all devices
  • Dark Security Theme: Professional, modern dark UI
  • Server-side Encryption: All crypto operations happen on the server
  • Usage Tracking: SQLite database for anonymous usage statistics
  • Copy to Clipboard: One-click copy for encrypted/decrypted output
  • Real-time Feedback: Loading states and toast notifications

🚀 Quick Start

Prerequisites

  • Node.js 18+ installed
  • npm or yarn package manager

Local Development

  1. Clone and install dependencies:

    cd text-encrypt-decrypt
    npm install
  2. Start the development server:

    npm run dev
  3. Open in browser: Navigate to http://localhost:3000

Environment Variables

Create a .env.local file (optional):

# Database path for SQLite (defaults to ./data/usage.db)
DATABASE_PATH=./data/usage.db

📱 Testing on Mobile

  1. Start the dev server: npm run dev
  2. Find your local IP: ipconfig (Windows) or ifconfig (Mac/Linux)
  3. Open http://YOUR_LOCAL_IP:3000 on your phone (same WiFi network)

Or use browser DevTools:

  1. Press F12 → Toggle device toolbar (Ctrl+Shift+M)
  2. Select iPhone SE or other mobile preset
  3. Verify responsive layout

🔐 Encryption Flow

┌─────────────────────────────────────────────────────────┐
│                    ENCRYPTION                           │
├─────────────────────────────────────────────────────────┤
│  1. User enters plaintext + password                    │
│  2. Client sends to /api/encrypt                        │
│  3. Server generates random salt (32 bytes)             │
│  4. Server generates random IV (16 bytes)               │
│  5. PBKDF2 derives 256-bit key from password + salt     │
│  6. AES-256-GCM encrypts plaintext                      │
│  7. Server returns: base64(salt + IV + authTag + data)  │
└─────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────┐
│                    DECRYPTION                           │
├─────────────────────────────────────────────────────────┤
│  1. User enters ciphertext + password                   │
│  2. Client sends to /api/decrypt                        │
│  3. Server extracts salt, IV, authTag from ciphertext   │
│  4. PBKDF2 derives key from password + salt             │
│  5. AES-256-GCM decrypts and verifies authTag           │
│  6. Returns plaintext or error if password is wrong     │
└─────────────────────────────────────────────────────────┘

🔒 Security Notes

  • Passwords are never logged or stored
  • Plaintext is never persisted
  • Random salt/IV for each encryption (prevents rainbow table attacks)
  • PBKDF2 with 100,000 iterations (slows brute-force attacks)
  • GCM auth tag (detects tampering)

📝 License

MIT License - feel free to use and modify!

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages