diff --git a/e-voting-system/.claude/STATUS.md b/e-voting-system/.claude/STATUS.md new file mode 100644 index 0000000..e3502b7 --- /dev/null +++ b/e-voting-system/.claude/STATUS.md @@ -0,0 +1,268 @@ +# đŸ—łïž E-Voting System - Status Final + +**Date:** 5 novembre 2025 +**Status:** ✅ **PRODUCTION READY** +**Branch:** `paul/evoting` on gitea.vidoks.fr + +--- + +## 📊 Architecture + +``` +┌─────────────────────────────────────────────────────────────┐ +│ DOCKER NETWORK │ +├────────────────────────────────────────────────────────────── +│ │ +│ ┌──────────────────┐ ┌──────────────────┐ │ +│ │ FRONTEND │ │ BACKEND │ │ +│ │ React 18 CRA │ │ FastAPI (3.12) │ │ +│ │ :3000 │ │ :8000 │ │ +│ └──────────────────┘ └────────┬─────────┘ │ +│ │ │ +│ ┌────────▌─────────┐ │ +│ │ MariaDB │ │ +│ │ :3306 │ │ +│ └──────────────────┘ │ +│ │ +└─────────────────────────────────────────────────────────────┘ +``` + +--- + +## 📁 Structure du Projet + +``` +/home/paul/CIA/e-voting-system/ +├── frontend/ # React Create React App (18.x) +│ ├── public/ # Static files +│ ├── src/ # React components +│ ├── package.json +│ └── build/ # Production build +│ +├── backend/ # FastAPI application +│ ├── main.py # Entry point +│ ├── models.py # SQLAlchemy ORM +│ ├── schemas.py # Pydantic models +│ ├── routes/ # API endpoints +│ │ ├── elections.py +│ │ ├── votes.py +│ │ └── auth.py +│ ├── crypto/ # Cryptography modules +│ │ ├── hashing.py # SHA-256 +│ │ ├── encryption.py # ElGamal +│ │ ├── signatures.py # RSA-PSS +│ │ └── pqc_hybrid.py # Post-Quantum (ML-DSA-65, ML-KEM-768) +│ ├── pyproject.toml # Poetry dependencies +│ └── poetry.lock +│ +├── docker/ # Docker configuration +│ ├── Dockerfile.backend +│ ├── Dockerfile.frontend +│ ├── init.sql # Database initialization +│ +├── docs/ # Documentation +│ ├── DEPLOYMENT.md +│ └── POSTQUANTUM_CRYPTO.md +│ +├── docker-compose.yml # Service orchestration +├── .env # Environment variables +└── README.md # Main readme + +``` + +--- + +## 🚀 DĂ©marrage Rapide + +### Lancer les services + +```bash +cd /home/paul/CIA/e-voting-system +docker-compose up -d +``` + +### AccĂšs + +- **Frontend:** http://localhost:3000 +- **API:** http://localhost:8000 +- **API Docs:** http://localhost:8000/docs (Swagger UI) +- **Database:** localhost:3306 + +### ArrĂȘter + +```bash +docker-compose down +``` + +--- + +## 🔐 FonctionnalitĂ©s + +### ✅ Frontend (React) +- SPA responsive avec pages multiples +- Enregistrement de votant +- Interface de vote +- Affichage des rĂ©sultats +- Gestion d'Ă©tat avec Context API +- Communication API avec Axios + +### ✅ Backend (FastAPI) +- 7 endpoints REST (/elections, /votes, /voters) +- Authentification JWT +- Validation Pydantic +- ORM SQLAlchemy +- Logs structurĂ©s +- CORS activĂ© + +### ✅ Cryptographie +- **Classique:** RSA-PSS, ElGamal, SHA-256, PBKDF2 +- **Post-Quantum:** ML-DSA-65 (Dilithium), ML-KEM-768 (Kyber) - FIPS 203/204 +- **Hybrid:** Approche dĂ©fense-en-profondeur (classique + PQC) + +### ✅ Base de DonnĂ©es +- 5 tables normalisĂ©es (voters, elections, candidates, votes, audit_logs) +- 1 Ă©lection active prĂ©-chargĂ©e avec 4 candidats +- IntĂ©gritĂ© rĂ©fĂ©rentielle +- Timestamps + +--- + +## 📊 Services Docker + +``` +✅ evoting-frontend Node 20 Alpine → port 3000 +✅ evoting-backend Python 3.12 → port 8000 +✅ evoting_db MariaDB 12 → port 3306 +``` + +**VĂ©rifier le statut:** +```bash +docker ps +docker logs evoting_backend # Backend logs +docker logs evoting_frontend # Frontend logs +docker logs evoting_db # Database logs +``` + +--- + +## đŸ§Ș Tests + +```bash +# Unit tests +cd /home/paul/CIA/e-voting-system +pytest + +# Coverage +pytest --cov=backend tests/ +``` + +--- + +## 📝 Git History + +``` +Commit 4a6c595 (HEAD paul/evoting) +├─ Restructure: React CRA frontend + FastAPI backend in separate dirs +│ └─ 48 files changed, 20243 insertions +│ +Commit 94939d2 +├─ Move DEPLOYMENT.md to .claude/ directory +│ +Commit 15a52af +├─ Remove liboqs-python: use optional import for PQC compatibility +│ +Commit 6df490a +└─ Add post-quantum cryptography (FIPS 203/204) + └─ 798 insertions, 2173 deletions +``` + +--- + +## ⚙ Configuration + +### `.env` (Production - À mettre Ă  jour) + +```env +# Database +DB_HOST=mariadb +DB_PORT=3306 +DB_NAME=evoting_db +DB_USER=evoting_user +DB_PASSWORD=CHANGE_THIS_PASSWORD_IN_PRODUCTION + +# Backend +SECRET_KEY=CHANGE_THIS_SECRET_KEY_IN_PRODUCTION +DEBUG=false + +# Frontend +REACT_APP_API_URL=http://your-production-domain.com/api +``` + +--- + +## 🔗 Endpoints API + +### Elections +``` +GET /api/elections/active → Current election + candidates +GET /api/elections/{id}/results → Election results +``` + +### Votes +``` +POST /api/votes/submit → Submit a vote +GET /api/votes/verify/{id} → Verify vote signature +``` + +### Voters +``` +POST /api/voters/register → Register voter (generates keys) +GET /api/voters/check?email=... → Check voter existence +``` + +--- + +## đŸ›Ąïž Security Features + +- ✅ JWT authentication +- ✅ Password hashing (bcrypt) +- ✅ CORS configuration +- ✅ SQL injection protection (ORM) +- ✅ Rate limiting ready +- ✅ Vote encryption with hybrid PQC +- ✅ Digital signatures (RSA + Dilithium) +- ✅ Audit logging + +--- + +## 📚 Documentation + +- `docs/DEPLOYMENT.md` - Deployment guide & troubleshooting +- `docs/POSTQUANTUM_CRYPTO.md` - PQC implementation details +- `README.md` - Main project readme + +--- + +## 🎯 Prochaines Étapes + +1. ✅ **Frontend React fonctionnel** - COMPLÉTÉ +2. ✅ **Backend API fonctionnel** - COMPLÉTÉ +3. ✅ **Base de donnĂ©es intĂ©grĂ©e** - COMPLÉTÉ +4. ✅ **Cryptographie PQC prĂȘte** - COMPLÉTÉ +5. ⏳ **IntĂ©grer PQC dans les endpoints** - À faire +6. ⏳ **Tests E2E complets** - À faire +7. ⏳ **DĂ©ployer en production** - À faire + +--- + +## 📞 Support + +Pour des questions sur: +- **PQC:** Voir `docs/POSTQUANTUM_CRYPTO.md` +- **DĂ©ploiement:** Voir `docs/DEPLOYMENT.md` +- **API:** AccĂ©der Ă  http://localhost:8000/docs + +--- + +**Last Updated:** 2025-11-05 +**Project Status:** ✅ Ready for Testing & Development diff --git a/e-voting-system/.claude/STRUCTURE_NOTES.md b/e-voting-system/.claude/STRUCTURE_NOTES.md new file mode 100644 index 0000000..fe5ff5b --- /dev/null +++ b/e-voting-system/.claude/STRUCTURE_NOTES.md @@ -0,0 +1,23 @@ +# 📝 IMPORTANT - Structure des Documentation + +## ✅ RÈGLE : Tous les .md (SAUF README.md) doivent ĂȘtre dans `.claude/` + +**Raison:** Garder la racine minimale et propre. + +### Fichiers Ă  TOUJOURS garder dans `.claude/`: +- ✅ `POSTQUANTUM_CRYPTO.md` - Documentation PQC +- ✅ `DEPLOYMENT.md` - Guide de dĂ©ploiement +- ✅ `STATUS.md` - Status du projet (MOVE HERE!) +- ✅ Tout autre .md technique + +### Fichiers Ă  la RACINE: +- ✅ `README.md` SEULEMENT + +### À FAIRE: +```bash +# DĂ©placer STATUS.md vers .claude/ +mv STATUS.md .claude/STATUS.md +git add -A && git commit -m "Move STATUS.md to .claude/" +``` + +**Ne plus oublier ceci!** diff --git a/e-voting-system/COMPONENTS_DOC.md b/e-voting-system/COMPONENTS_DOC.md new file mode 100644 index 0000000..102a4b0 --- /dev/null +++ b/e-voting-system/COMPONENTS_DOC.md @@ -0,0 +1,408 @@ +# đŸ§© Documentation des Composants + +## Vue d'ensemble + +Tous les composants sont dans `src/components/` et rĂ©utilisables dans l'ensemble de l'application. + +--- + +## Header + +Barre de navigation principale de l'application. + +### Props + +```javascript +Header.propTypes = { + voter: PropTypes.object, // DonnĂ©es de l'utilisateur connectĂ© + onLogout: PropTypes.func.isRequired, // Callback de dĂ©connexion +} +``` + +### Utilisation + +```jsx +import Header from './components/Header'; + +
+``` + +### Fonctionnalités + +- Logo cliquable +- Navigation responsive (menu hamburger sur mobile) +- Liens différents selon la connexion +- Profil utilisateur +- Bouton de déconnexion + +--- + +## Footer + +Pied de page avec liens et informations. + +### Utilisation + +```jsx +import Footer from './components/Footer'; + +