14 Commits

Author SHA1 Message Date
E-Voting Developer
dfdf159198 fix: ElGamal encryption, vote deduplication, and frontend data validation
- Fixed ElGamal class instantiation in votes.py (ElGamalEncryption instead of ElGamal)
- Fixed public key serialization in admin.py (use public_key_bytes property)
- Implemented database migration with SQL-based key generation
- Added vote deduplication endpoint: GET /api/votes/check
- Protected all array accesses with type validation in frontend
- Fixed vote parameter type handling (string to number conversion)
- Removed all debug console logs for production
- Created missing dynamic route for vote history details

Fixes:
- JavaScript error: "can't access property length, e is undefined"
- Vote deduplication not preventing form display
- Frontend data validation issues
- Missing dynamic routes
2025-11-08 00:05:19 +01:00
Alexis Bruneteau
f825a2392c feat: Implement dark theme for frontend with toggle
Changes:
- Add next-themes dependency for theme management
- Create ThemeProvider wrapper for app root layout
- Set dark mode as default theme
- Create ThemeToggle component with Sun/Moon icons
- Add theme toggle to home page navigation
- Add theme toggle to dashboard header
- App now starts in dark mode with ability to switch to light mode

Styling uses existing Tailwind dark mode variables configured in
tailwind.config.ts and globals.css. All existing components automatically
support dark theme.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 16:35:44 +01:00
Alexis Bruneteau
c6a0bb1654 feat: Complete frontend-backend API integration for voting system
This commit completes the voting system implementation with:

1. Frontend API Proxy Routes:
   - Created 9 Next.js API routes to proxy backend requests
   - Elections endpoints: /api/elections/*, /api/elections/{id}/*
   - Votes endpoints: /api/votes/*, /api/votes/submit/*, etc.
   - Auth endpoints: /api/auth/register/*, /api/auth/login/*, /api/auth/profile/*
   - Fixed Next.js 15.5 compatibility with Promise-based params

2. Backend Admin API:
   - Created /api/admin/fix-elgamal-keys endpoint
   - Created /api/admin/elections/elgamal-status endpoint
   - Created /api/admin/init-election-keys endpoint
   - All endpoints tested and working

3. Database Schema Fixes:
   - Fixed docker/create_active_election.sql to preserve ElGamal parameters
   - All elections now have elgamal_p=23, elgamal_g=5 set
   - Public keys generated for voting encryption

4. Documentation:
   - Added VOTING_SYSTEM_STATUS.md with complete status
   - Added FINAL_SETUP_STEPS.md with setup instructions
   - Added fix_elgamal_keys.py utility script

System Status:
 Backend: All 3 nodes operational with 12 elections
 Database: ElGamal parameters initialized
 Crypto: Public keys generated for active elections
 API: All endpoints verified working
 Frontend: Proxy routes created (ready for rebuild)

Next Step: docker compose up -d --build frontend

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 03:32:08 +01:00
Alexis Bruneteau
becdf3bdee fix: Improve active elections endpoint with timezone buffer and debug endpoint 2025-11-07 02:55:39 +01:00
Alexis Bruneteau
b8fa1a4b95 fix: Add active election to database initialization for demo 2025-11-07 02:53:46 +01:00
Alexis Bruneteau
5ac2a49a2a fix: Add citizen_id field to registration form (fixes 422 error) 2025-11-07 02:39:17 +01:00
Alexis Bruneteau
368bb38057 chore: Setup complete Docker Compose configuration
Comprehensive Docker Compose setup with all services:

Services:
  • MariaDB 11 - Database with persistent storage
  • FastAPI Backend - Python 3.12 with Poetry
  • Next.js Frontend - Node 20 with production build
  • Adminer - Optional database management UI

Features:
  ✓ Health checks for all services
  ✓ Proper dependency ordering (database -> backend -> frontend)
  ✓ Networking with private subnet (172.20.0.0/16)
  ✓ Volume management for data persistence
  ✓ Environment variable configuration
  ✓ Logging configuration (10MB max, 3 files)
  ✓ Restart policies (unless-stopped)

Configuration Files:
  • docker-compose.yml - Production-ready compose file
  • .env - Development environment variables
  • .env.example - Template for environment setup
  • DOCKER_SETUP.md - Comprehensive setup guide

Improvements:
  • Added curl to backend Dockerfile for health checks
  • Better error handling and startup sequencing
  • Database initialization with multiple SQL files
  • Adminer for easy database management (port 8080)
  • Detailed logging with file rotation
  • Production-ready with comments and documentation

Environment Variables:
  Database:
    DB_HOST=mariadb, DB_PORT=3306
    DB_NAME=evoting_db, DB_USER=evoting_user
    DB_PASSWORD=evoting_pass123

  Services:
    BACKEND_PORT=8000, FRONTEND_PORT=3000

  Security:
    SECRET_KEY=your-secret-key-change-in-production
    DEBUG=false (for production)

Health Checks:
  • Database: mariadb-admin ping
  • Backend: curl /health endpoint
  • Frontend: wget to port 3000

Volumes:
  • evoting_data - MariaDB persistent storage
  • backend_cache - Backend cache directory

Networks:
  • evoting_network (172.20.0.0/16)
  • Internal service-to-service communication

Quick Start:
  1. cp .env.example .env
  2. docker-compose up -d
  3. http://localhost:3000 (frontend)
  4. http://localhost:8000/docs (API docs)
  5. http://localhost:8080 (database admin)

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 02:09:07 +01:00
Alexis Bruneteau
68c0648cf1 fix: Update Docker config for Next.js frontend
- Updated Dockerfile.frontend to use Next.js instead of React CRA
- Multi-stage build for optimized image size
- Use NEXT_PUBLIC_API_URL instead of REACT_APP_API_URL
- Updated docker-compose.yml to pass correct env variable
- Frontend now starts with 'npm start' instead of serve

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 17:42:20 +01:00
E-Voting Developer
8baabf528c feat: Implement Historique and Upcoming Votes pages with styling and data fetching
- Added HistoriquePage component to display user's voting history with detailed statistics and vote cards.
- Created UpcomingVotesPage component to show upcoming elections with a similar layout.
- Developed CSS styles for both pages to enhance visual appeal and responsiveness.
- Integrated API calls to fetch user's votes and upcoming elections.
- Added a rebuild script for Docker environment setup and data restoration.
- Created a Python script to populate the database with sample data for testing.
2025-11-06 05:12:03 +01:00
E-Voting Developer
839ca5461c Fix: Login system and clean up duplicate src/ folder
- Fixed LoginPage.js to use correct API endpoint (localhost:8000)
- Fixed prop naming (onLoginSuccess → onLogin)
- Fixed data structure mapping (voter.email → email, etc)
- Removed duplicate src/ folder structure
- Updated DashboardPage.js with proper API endpoints
- Added lucide-react dependency
- Fixed docker-compose and Dockerfile.backend for proper execution
- Cleaned up console logs
- System fully working with Docker deployment
2025-11-05 23:25:43 +01:00
E-Voting Developer
4a6c59572a Restructure: React CRA frontend + FastAPI backend in separate dirs + Docker fixes 2025-11-05 18:45:45 +01:00
E-Voting Developer
94939d2984 Move DEPLOYMENT.md to .claude/ directory 2025-11-05 18:08:21 +01:00
E-Voting Developer
6df490a7b1 Add post-quantum cryptography (FIPS 203/204)
- Add hybrid PQC using liboqs: ML-DSA-65 (Dilithium) + ML-KEM-768 (Kyber)
- Signatures: RSA-PSS + Dilithium (defense-in-depth)
- Encryption: ML-KEM-768 (Kyber) + ElGamal
- Tests for PQC hybrid operations
- Cleanup: remove non-essential scripts and docs
- Minimal, production-ready e-voting system
2025-11-05 17:49:29 +01:00
E-Voting Developer
5bebad45b8 Initial commit: Complete e-voting system with cryptography
- FastAPI backend with JWT authentication
- ElGamal, RSA-PSS, ZK-proofs crypto modules
- HTML5/JS frontend SPA
- MariaDB database with 5 tables
- Docker Compose with 3 services (frontend, backend, mariadb)
- Comprehensive tests for cryptography
- Typst technical report (30+ pages)
- Makefile with development commands
2025-11-03 16:13:08 +01:00