Skip to content

Repository files navigation

πŸš€ Secure-Creds_GSSoC-2025

Typing SVG

Your Personalized Credential Manager

πŸ“Š Project Insights

🌟 Stars 🍴 Forks πŸ› Issues πŸ”” Open PRs πŸ”• Closed PRs πŸ› οΈ Languages πŸ‘₯ Contributors
Stars Forks Issues Open PRs Closed PRs Languages Count Contributors Count

🎯 Open Source Programmes ⭐

This project is now OFFICIALLY accepted for:

GSSOC

🌟 Exciting News...

πŸš€ This project is now an official part of GirlScript Summer of Code – GSSoC 2025! πŸ’ƒπŸŽ‰πŸ’» We’re thrilled to welcome contributors from all over India and beyond to collaborate, build, and grow .

πŸ‘©β€πŸ’» GSSoC is one of India’s largest 3-month-long open-source programs that encourages developers of all levels to contribute to real-world projects 🌍 while learning, collaborating, and growing together. 🌱

🌈 With mentorship, community support, and collaborative coding, it's the perfect platform for developers to:

✨ Improve their skills 🀝 Contribute to impactful projects πŸ† Get recognized for their work πŸ“œ Receive certificates and swag!

πŸŽ‰ I can’t wait to welcome new contributors from GSSoC 2025 to this Secure-Creds project family! Let’s build, learn, and grow together β€” one commit at a time. πŸ”₯πŸ‘¨β€πŸ’»πŸ‘©β€πŸ’»

πŸ” Secure Credential Manager

Make sure to star the repo before working on

A Secure Credential Manager built using the MERN stack (MongoDB, Express, React, Node.js) with advanced cryptographic features to ensure maximum security. It uses CryptoJS and bcrypt for encryption and hashing, and JWT for session management.


πŸš€ Features

  • πŸ” User Authentication using hashed passwords (bcrypt)
  • πŸ” JWT-based Session Management (expires after 15 minutes)
  • πŸ” Multi-Factor Authentication (MFA) - TOTP, Email, SMS
  • πŸ” Protected Routes: Only authenticated users can access sensitive routes
  • πŸ” Password Verification required to perform sensitive operations (even with valid session)
  • πŸ” Credential Encryption using a unique key per credential
  • πŸ” QR Code Generation for TOTP authenticator setup
  • πŸ” Backup Codes for emergency MFA access
  • πŸ” Encryption Keys are never stored in the database or backend memory
  • πŸ” Sensitive data is cleared from memory immediately after use
  • πŸ” Add / View / Delete credentials securely
  • ⚠️ Mitigates session hijacking via enforced re-verification using password
  • πŸ“± Responsive Design - Works on desktop and mobile devices
  • 🎨 Modern UI/UX with intuitive navigation
  • Dark Mode available

🧠 Tech Stack

  • Frontend: React, Axios
  • Backend: Node.js, Express.js
  • Database: MongoDB with Mongoose
  • Encryption/Hashing: CryptoJS, bcrypt
  • Auth & Session: JSON Web Tokens (JWT)
  • Security Principles: Zero knowledge encryption, protected routes, memory safety

🧰 How It Works

  1. πŸ” User Registration & Login

  • Passwords are hashed using bcrypt before storing in DB.
  • On successful login, a JWT token is issued, valid for 15 minutes.
  1. πŸ›‘οΈ Protected Routes

  • All sensitive backend routes require a valid JWT token.
  • Unauthorized users are blocked.
  1. 🧾 Add / View / Delete Credentials

  • Each operation requires password confirmation, even if JWT is valid.
  • This ensures protection in case the session token is hijacked.
  1. πŸ”‘ Encryption Logic

  • Each credential is encrypted with a unique key:
    key = SHA256(salt + credentialUID + userPassword)
    
  • The key is never stored.
  • The encrypted data is stored, but key is derived on-the-fly during decryption.
  1. 🧹 Memory Safety

  • Sensitive keys, raw passwords, and decrypted data are immediately removed from memory after use.

πŸ“Έ Screenshots

Landing Page

Landing Page Landing Page Landing Page Landing Page

πŸ–₯️ Registration Page

Registration Page

πŸ–₯️ Login Page

Login Page

🏠 Dashboard

Dashboard

πŸ” Add Credential

Add Credential Add Credential Add Credential

  • After adding creds Add Credential

πŸ—‚οΈ View Credentials

View Credentials View Credentials

🧰 Delete Credentials

Re-authenticate

  • After Deleting

Re-authenticate

πŸ› οΈ Setup Instructions for development

βš™οΈ Prerequisites

  • Node.js (v18 or higher)
  • npm (v8 or higher)
  • MongoDB (Local installation or MongoDB Atlas)
  • Git

πŸ“¦ Installation

1. Clone the Repository

git clone https://github.com/Abhishek-Verma0/PETV83L-Abhishek-Verma-Secure-Credential-Manager-With-Key-Encryption.git
cd PETV83L-Abhishek-Verma-Secure-Credential-Manager-With-Key-Encryption

2. Install backend dependencies

cd server
npm install

πŸ”§ Environment Configuration

Server Environment Variables

Create a .env file in the server directory:

# ================================
# REQUIRED CONFIGURATION
# ================================

# Database Configuration
MONGODB_URL=mongodb://localhost:27017/credentialmanager
# For MongoDB Atlas: mongodb+srv://username:password@cluster.mongodb.net/credentialmanager

# JWT Secret (Use a strong, random string)
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production-min-32-chars

# Server Port
PORT=5000

# ================================
# OPTIONAL - EMAIL MFA CONFIGURATION
# ================================

# Gmail Configuration (Recommended)
EMAIL_USER=your-email@gmail.com
EMAIL_PASS=your-gmail-app-password  # NOT your regular password - use App Password
EMAIL_FROM=noreply@credentialmanager.com

# Alternative Email Providers
# EMAIL_HOST=smtp.your-provider.com
# EMAIL_PORT=587
# EMAIL_SECURE=false

# ================================
# OPTIONAL - SMS MFA CONFIGURATION (Twilio)
# ================================

TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=your-twilio-auth-token
TWILIO_PHONE_NUMBER=+1234567890

# ================================
# DEVELOPMENT SETTINGS
# ================================

NODE_ENV=development
# start backend server
npm start

Client Environment Variables For development

Create a .env file in the client directory:

env
# API Configuration
VITE_API_URL=http://localhost:5000
VITE_PORT=5173

# Start frontend server

 npm run dev
  1. Access the Application
    • Open your browser and go to http://localhost:5000
    • Register a new account or login with existing credentials

πŸ“§ Email MFA Setup (Optional)

Gmail Configuration (Recommended)

  1. Enable 2-Factor Authentication on your Gmail account
  2. Generate App Password:
    • Go to Google Account Settings
    • Security β†’ 2-Step Verification β†’ App passwords
    • Select "Mail" and generate a 16-character password
  3. Update .env file:
    EMAIL_USER=youremail@gmail.com
    EMAIL_PASS=abcd-efgh-ijkl-mnop  # 16-character app password

Other Email Providers

For other email services, modify the configuration in server/services/emailService.js:

// Outlook/Hotmail
service: 'hotmail'

// Yahoo
service: 'yahoo'

// Custom SMTP
host: 'smtp.your-provider.com'
port: 587
secure: false

πŸ“± SMS MFA Setup (Optional)

  1. Sign up for Twilio: https://www.twilio.com/
  2. Get a phone number from Twilio Console
  3. Find your credentials:
    • Account SID (starts with AC...)
    • Auth Token
    • Phone Number (format: +1234567890)
  4. Update .env file:
    TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    TWILIO_AUTH_TOKEN=your-auth-token-here
    TWILIO_PHONE_NUMBER=+1234567890

πŸ—„οΈ Database Setup

Local MongoDB

  1. Install MongoDB on your system
  2. Start MongoDB service:
    # macOS (with Homebrew)
    brew services start mongodb-community
    
    # Linux (Ubuntu)
    sudo systemctl start mongod
    
    # Windows
    # Start MongoDB service from Services panel
  3. Use connection string:
    MONGODB_URL=mongodb://localhost:27017/credentialmanager

MongoDB Atlas (Cloud)

  1. Create account at MongoDB Atlas
  2. Create a cluster
  3. Get connection string and replace <username>, <password>, and <cluster-url>
  4. Use connection string:
    MONGODB_URL=mongodb+srv://username:password@cluster.mongodb.net/credentialmanager

πŸ” Dependencies Breakdown

Backend Dependencies

{
  "bcrypt": "^6.0.0",           // Password hashing
  "bcryptjs": "^3.0.2",         // Alternative password hashing
  "cors": "^2.8.5",             // Cross-origin resource sharing
  "dotenv": "^17.0.0",          // Environment variables
  "express": "^5.1.0",          // Web framework
  "jsonwebtoken": "^9.0.2",     // JWT authentication
  "mongoose": "^8.16.1",        // MongoDB object modeling
  "nodemailer": "^6.10.1",      // Email sending
  "qrcode": "^1.5.4",           // QR code generation for MFA
  "speakeasy": "^2.0.0",        // TOTP implementation
  "twilio": "^4.23.0"           // SMS sending
}

Frontend Dependencies

{
  "axios": "^1.10.0",           // HTTP client
  "react": "^19.1.0",           // UI library
  "react-dom": "^19.1.0",       // React DOM rendering
  "react-qr-code": "^2.0.18",   // QR code display component
  "react-router-dom": "^7.6.3"  // Client-side routing
}

πŸ›‘οΈ Security Features

  • πŸ” Password Hashing: bcrypt with salt rounds
  • πŸ”‘ JWT Authentication: 15-minute token expiration
  • πŸ›‘οΈ Multi-Factor Authentication: TOTP, Email, SMS
  • πŸ”’ Credential Encryption: AES-256 with unique keys per credential
  • 🚫 Memory Safety: Sensitive data cleared immediately after use
  • πŸ” Protected Routes: Authentication required for sensitive operations
  • 🎫 Backup Codes: Emergency access codes for MFA

πŸ“± MFA Features

  • πŸ“± TOTP (Time-based One-Time Password): Works with Google Authenticator, Authy, 1Password
  • πŸ“§ Email MFA: Verification codes sent to registered email
  • πŸ“² SMS MFA: Verification codes sent via text message
  • 🎫 Backup Codes: 10 single-use emergency codes
  • πŸ”„ Easy Management: Enable/disable, regenerate codes

🎯 Development vs Production

Development Mode

  • Email: Uses Ethereal test service (no real emails sent)
  • SMS: Mock mode (codes logged to console)
  • Database: Local MongoDB recommended
  • Hot Reload: Both client and server support hot reload

Production Deployment

  • Environment: Set NODE_ENV=production
  • Email: Configure real email service
  • SMS: Configure Twilio for real SMS
  • Database: Use MongoDB Atlas or secure MongoDB instance
  • SSL/HTTPS: Required for production
  • Environment Variables: Use secure secret management

πŸ› Troubleshooting

Common Issues

  1. MongoDB Connection Failed

    Solution: Check if MongoDB is running and connection string is correct
    
  2. JWT Token Expired

    Solution: Login again - tokens expire after 15 minutes for security
    
  3. Email MFA Not Working

    Solution: Use Gmail App Password, not regular password
    
  4. SMS MFA Not Working

    Solution: Verify Twilio credentials and phone number format
    
  5. Port Already in Use

    # Check what's using the port
    lsof -i :5000
    # Kill the process
    kill -9 [PID]

Debug Mode

Enable verbose logging:

DEBUG=true
LOG_LEVEL=debug

πŸ“ Project Structure

PETV83L-Abhishek-Verma-Secure-Credential-Manager-With-Key-Encryption/
β”œβ”€β”€ πŸ“‚ client/                          # Frontend React application
β”‚   β”œβ”€β”€ πŸ“‚ public/                      # Static assets
β”‚   β”‚   └── lock-icon.svg
β”‚   β”œβ”€β”€ πŸ“‚ src/
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ auth/                    # Authentication context
β”‚   β”‚   β”‚   └── AuthContext.jsx
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ components/              # Reusable UI components
β”‚   β”‚   β”‚   β”œβ”€β”€ Button.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Footer.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ FormInput.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ MFASettings.jsx         # MFA setup and management
β”‚   β”‚   β”‚   β”œβ”€β”€ MFAVerification.jsx     # MFA login verification
β”‚   β”‚   β”‚   β”œβ”€β”€ Navbar.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ PasswordPrompt.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ ProtectedRoute.jsx
β”‚   β”‚   β”‚   └── ScreenshotPrevention.jsx
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ pages/                   # Main application pages
β”‚   β”‚   β”‚   β”œβ”€β”€ Dashboard.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ ForgotPassword.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Landing.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Login.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ MFAPage.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Register.jsx
β”‚   β”‚   β”‚   └── ResetPassword.jsx
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ service/                 # API service layer
β”‚   β”‚   β”‚   β”œβ”€β”€ auth.js
β”‚   β”‚   β”‚   β”œβ”€β”€ credentials.js
β”‚   β”‚   β”‚   └── mfa.js                  # MFA API calls
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ styles/                  # Component styles
β”‚   β”‚   β”‚   β”œβ”€β”€ dashboard.css
β”‚   β”‚   β”‚   β”œβ”€β”€ mfaSettings.css
β”‚   β”‚   β”‚   β”œβ”€β”€ mfaVerification.css
β”‚   β”‚   β”‚   β”œβ”€β”€ responsive.css
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   β”œβ”€β”€ App.jsx                     # Main app component
β”‚   β”‚   └── main.jsx                    # App entry point
β”‚   β”œβ”€β”€ package.json
β”‚   └── vite.config.js
β”œβ”€β”€ πŸ“‚ server/                          # Backend Node.js application
β”‚   β”œβ”€β”€ πŸ“‚ middleware/                  # Express middleware
β”‚   β”‚   β”œβ”€β”€ auth.js                     # JWT authentication
β”‚   β”‚   └── mfa.js                      # MFA verification
β”‚   β”œβ”€β”€ πŸ“‚ models/                      # MongoDB models
β”‚   β”‚   β”œβ”€β”€ Credential.js
β”‚   β”‚   └── User.js                     # Enhanced with MFA fields
β”‚   β”œβ”€β”€ πŸ“‚ routes/                      # API routes
β”‚   β”‚   β”œβ”€β”€ auth.js                     # Authentication routes
β”‚   β”‚   β”œβ”€β”€ credentials.js              # Credential CRUD operations
β”‚   β”‚   β”œβ”€β”€ mfa.js                      # MFA setup and verification
β”‚   β”‚   └── passwordReset.js
β”‚   β”œβ”€β”€ πŸ“‚ services/                    # External service integrations
β”‚   β”‚   β”œβ”€β”€ emailService.js             # Email OTP and notifications
β”‚   β”‚   └── smsService.js               # SMS OTP via Twilio
β”‚   β”œβ”€β”€ index.js                        # Server entry point
β”‚   └── package.json
β”œβ”€β”€ πŸ“‚ screenshots/                     # Application screenshots
β”œβ”€β”€ πŸ“„ MFA_SETUP_GUIDE.md              # Detailed MFA setup guide
└── πŸ“„ README.md                       # This file

About

Secure-Creds is Credential managing application which keeps safe your Credentials by encrypting using unique Key for each credential.

Resources

Stars

6 stars

Watchers

2 watching

Forks

Contributors

Languages