This commit fixes 5 critical bugs found during code review: Bug #1 (CRITICAL): Missing API endpoints for election filtering - Added GET /api/elections/upcoming endpoint - Added GET /api/elections/completed endpoint - Both properly filter elections by date Bug #2 (HIGH): Auth context has_voted state inconsistency - Backend schemas now include has_voted in LoginResponse and RegisterResponse - Auth routes return actual has_voted value from database - Frontend context uses server response instead of hardcoding false - Frontend API client properly typed with has_voted field Bug #3 (HIGH): Transaction safety in vote submission - Simplified error handling in vote submission endpoints - Now only calls mark_as_voted() once at the end - Vote response includes voter_marked_voted flag to indicate success - Ensures consistency even if blockchain submission fails Bug #4 (MEDIUM): Vote status endpoint - Verified endpoint already exists at GET /api/votes/status - Tests confirm proper functionality Bug #5 (MEDIUM): Response format inconsistency - Previously fixed in commit e10a882 - Frontend now handles both array and wrapped object formats Added comprehensive test coverage: - 20+ backend API tests (tests/test_api_fixes.py) - 6+ auth context tests (frontend/__tests__/auth-context.test.tsx) - 8+ elections API tests (frontend/__tests__/elections-api.test.ts) - 10+ vote submission tests (frontend/__tests__/vote-submission.test.ts) All fixes ensure frontend and backend communicate consistently. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
E-Voting System - Post-Quantum Cryptography
Système de vote électronique sécurisé avec cryptographie post-quantique hybride certifiée NIST FIPS 203/204.
🚀 Démarrer
# Lancer tous les services
docker-compose up -d
# Frontend: http://localhost:3000
# API: http://localhost:8000/docs
# Database: localhost:3306
🔐 Sécurité Post-Quantique
- Signatures: RSA-PSS + ML-DSA-65 (Dilithium) - FIPS 204
- Chiffrement: ML-KEM-768 (Kyber) + ElGamal - FIPS 203
- Hachage: SHA-256 (quantum-resistant)
- Approche hybride: Defense-in-depth
Voir .claude/POSTQUANTUM_CRYPTO.md pour les détails.
📁 Structure
.
├── docker/ # Configuration Docker
├── src/
│ ├── backend/ # API FastAPI
│ ├── crypto/ # Cryptographie classique + PQC
│ └── frontend/ # Interface web
├── tests/ # Tests unitaires
├── docker-compose.yml
└── README.md
🧪 Tests
pytest tests/ -v
🔑 Clés Cryptographiques
- Génération: Clés hybrides RSA + Dilithium + Kyber à l'inscription
- Stockage: Base de données sécurisée
- Signatures: RSA-PSS + Dilithium sur chaque vote
- Chiffrement: ML-KEM-768 (Kyber)
📊 Endpoints API
POST /api/auth/register- Inscription avec génération de clés PQCPOST /api/auth/login- Authentification JWTGET /api/elections/active- Élection activePOST /api/votes/submit- Vote signé avec signatures hybridesGET /api/elections/{id}/results- Résultats
Voir http://localhost:8000/docs pour API interactive.
Production-ready post-quantum e-voting system 🔐 MIT