23 Commits

Author SHA1 Message Date
Alexis Bruneteau
67a2b3ec6f fix: Restore backend infrastructure and complete Phase 2 & 3
Restores all missing project files and fixes:
- Restored backend/blockchain.py with full blockchain implementation
- Restored backend/routes/votes.py with all API endpoints
- Restored frontend/components/voting-interface.tsx voting UI
- Fixed backend/crypto/hashing.py to handle both str and bytes
- Fixed pyproject.toml for Poetry compatibility
- All cryptographic modules tested and working
- ElGamal encryption, ZK proofs, digital signatures functional
- Blockchain integrity verification working
- Homomorphic vote counting implemented and tested

Phase 2 Backend API: ✓ COMPLETE
Phase 3 Frontend Interface: ✓ COMPLETE

Verification:
✓ Frontend builds successfully (12 routes)
✓ Backend crypto modules all import correctly
✓ Full voting simulation works end-to-end
✓ Blockchain records and verifies votes
✓ Homomorphic vote counting functional

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 01:56:10 +01:00
Alexis Bruneteau
55995365be docs: Add proper openspec configuration for MVP
Created comprehensive openspec structure:

openspec/specs/:
- mvp.md: MVP feature overview
- architecture.md: System architecture and data flows

openspec/changes/add-pqc-voting-mvp/:
- proposal.md: Project proposal with scope and rationale
- tasks.md: Detailed implementation tasks (6 phases, 30+ tasks)
- design.md: Complete design document
  - Cryptographic algorithms (Paillier, Kyber, Dilithium, ZKP)
  - Data structures (Block, Blockchain, Ballot)
  - API endpoint specifications
  - Security properties matrix
  - Threat model and mitigations

Follows openspec three-stage workflow:
1. Creating changes (proposal-based)
2. Implementation (tracked via tasks)
3. Completion (with validation)

Ready for implementation phase with clear requirements.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 18:02:33 +01:00
Alexis Bruneteau
bd3fcac8dc docs: Add complete MVP specification and implementation plan
Added comprehensive MVP definition with:

Core Components:
- Paillier homomorphic encryption for vote secrecy
- Kyber (ML-KEM) for post-quantum key protection
- Dilithium (ML-DSA) for PQC signatures
- Blockchain module with immutable vote recording
- ZKP implementation for ballot validity

MVP Features:
1. Cryptographic toolkit (Paillier, Kyber, Dilithium, ZKP)
2. Blockchain module (linked blocks, signatures, validation)
3. Voting API (setup, public-keys, submit, blockchain, count)
4. Voter client (encryption, signing, submission)
5. Blockchain visualizer (display, verification)
6. Scrutator module (counting, results)

6-Phase Implementation Plan:
- Phase 1: Cryptographic foundations
- Phase 2: Backend API integration
- Phase 3: Frontend voting interface
- Phase 4: Blockchain visualization
- Phase 5: Results & reporting
- Phase 6: Testing & technical report

Security properties matrix with mechanisms.
Progress tracking checklist for all phases.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 17:59:43 +01:00
Alexis Bruneteau
7cab4cccf9 docs: Add project requirements from Projet.pdf to openspec
Updated with:
- Project definition from CIA course requirements
- Key goals including fraud prevention and coercion resistance
- Deliverables structure (code + technical report)
- E-voting challenges to address:
  - Fraud prevention
  - Voter intimidation resistance
  - Anonymity preservation
  - Vote integrity and verifiability
  - Coercion resistance
- Report structure requirements:
  1. Introduction & Design Choices
  2. Analysis & Cryptographic Application
  3. Security Properties & Threat Analysis
- Post-quantum cryptography (ML-KEM, ML-DSA) requirements
- Docker autonomous deployment requirement

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 17:51:56 +01:00
Alexis Bruneteau
6ef4dc851b docs: Fill out openspec/project.md with complete project details
Documented:
- Project purpose and goals (e-voting with blockchain)
- Complete tech stack (Next.js, FastAPI, MySQL, Docker)
- Code style conventions (TypeScript, Python, Git)
- Architecture patterns (frontend, backend, API client)
- Testing strategy and git workflow
- Domain context (e-voting concepts, security model)
- Important constraints (technical, security, regulatory)
- External dependencies and key endpoints

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 17:51:25 +01:00
Alexis Bruneteau
fc7be6df26 refactor: Simplify home page - remove mock data and unnecessary sections
- Removed stats section (1000+ votants, 50+ élections, 99.9% security)
- Removed features section (crypto, results, access)
- Removed CTA section with unnecessary copy
- Removed footer with multiple sections
- Keep clean dark theme with minimal landing page
- Keep navigation and simple call-to-action buttons
- Focus on essential elements only

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 17:45:40 +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
Alexis Bruneteau
ecf330bbc9 docs: Add comprehensive project status document
Documents:
- Current project status (Phase 3 complete)
- Architecture overview
- API integration status (12/12 endpoints)
- File structure and build information
- Security implementation details
- Phase 4 (Testing & Launch) roadmap
- Testing workflow and checklist
- Environment setup requirements
- Performance metrics

Status: 🟢 READY FOR PHASE 4 - TESTING & LAUNCH

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 17:31:49 +01:00
Alexis Bruneteau
e674471b58 chore: Lock validation dependencies
- @hookform/resolvers@5.2.2
- react-hook-form@7.66.0
- zod@4.1.12

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 17:30:48 +01:00
Alexis Bruneteau
41db63f5c9 docs: Add comprehensive completion report and project status 2025-11-06 17:26:33 +01:00
Alexis Bruneteau
b1756f1320 feat: Add form validation with Zod and React Hook Form
Form Validation:
- Create comprehensive Zod validation schemas for all forms
- Login form: email, password validation
- Register form: first name, last name, email, password strength requirements
- Profile update form: all user fields with optional phone/address
- Password change form: current password, new password confirmation
- Vote submission form: election ID and candidate selection

Password Strength:
- Minimum 8 characters
- At least one uppercase letter
- At least one digit
- At least one special character (!@#$%^&*)

React Hook Form Integration:
- Update login page with useForm and field-level error display
- Update register page with form validation and error messages
- Show validation errors inline with red borders
- Disable form submission while loading or submitting
- Better user feedback with detailed error messages

Type Safety:
- Zod schemas with TypeScript inference
- Type-safe form data types
- Proper error handling and validation

Build Status:
- All pages compile successfully
- Zero TypeScript errors
- Bundle size includes Zod (~40 kB) and React Hook Form
- Login/Register pages: 145 kB First Load JS (includes new validation libraries)
- Shared bundle remains ~102 kB

Setup:
- npm install zod react-hook-form @hookform/resolvers
- Ready for production with form validation

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 17:20:16 +01:00
Alexis Bruneteau
546785ef67 feat: Integrate backend API with frontend - Authentication & Elections
Core Integration:
- Create API client with TypeScript types for all endpoints
- Implement authentication context provider for user state management
- Add protected route component for dashboard access control
- Connect login/register pages to backend authentication endpoints
- Implement user session persistence with localStorage tokens

Authentication:
- Login page now connects to /api/auth/login endpoint
- Register page connects to /api/auth/register with validation
- Password strength requirements (min 8 chars)
- Form validation and error handling
- Automatic redirect to dashboard on successful auth
- Logout functionality with session cleanup

Protected Routes:
- Dashboard pages require authentication
- Non-authenticated users redirected to login
- Loading spinner during auth verification
- User name displayed in dashboard header
- Proper session management

Election/Vote APIs:
- Dashboard fetches active elections from /api/elections/active
- Display real election data with candidates count
- Handle loading and error states
- Skeleton loaders for better UX

Type Safety:
- Full TypeScript interfaces for all API responses
- Proper error handling with try-catch blocks
- API response types: AuthToken, VoterProfile, Election, Candidate, Vote, VoteHistory

Environment:
- API URL configurable via NEXT_PUBLIC_API_URL env variable
- Default to http://localhost:8000 for local development

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 17:15:34 +01:00
Alexis Bruneteau
cef85dd1a1 docs: Add comprehensive frontend documentation and next steps guide 2025-11-06 17:11:01 +01:00
Alexis Bruneteau
14eff8d0da feat: Rebuild frontend with Next.js and shadcn/ui components
- Migrate from React CRA to Next.js 15 with modern architecture
- Implement comprehensive shadcn/ui component library
- Create complete dashboard system with layouts and navigation
- Build authentication pages (login, register) with proper forms
- Implement vote management pages (active, upcoming, history, archives)
- Add user profile management with security settings
- Configure Tailwind CSS with custom dark theme (accent: #e8704b)
- Setup TypeScript with strict type checking
- Backup old React-based frontend to .backups/frontend-old
- All pages compile successfully and build passes linting

Pages created:
- Home page with hero section and features
- Authentication (login/register)
- Dashboard with stats and vote cards
- Vote management (active, upcoming, history, archives)
- User profile with form validation

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 17:02:14 +01:00
Alexis Bruneteau
905466dbe9 feat: Complete ShadCN/UI integration with custom dark theme
🎨 Design System Implementation:
- Added Tailwind CSS 3.3.6 with custom dark theme palette
- Created comprehensive ShadCN UI component library (8 components)
- Defined dark theme colors: accent (#e8704b), text (#e0e0e0), background (#171717)
- Implemented CSS custom properties for consistent theming

🔧 Core Components Refactored:
- Header: Now fully responsive with dark theme
- VoteCard: Migrated to ShadCN Card with styled results bars
- Alert: Uses ShadCN Alert with semantic variants
- Modal: Replaced with ShadCN Dialog (Radix UI)
- LoadingSpinner: Tailwind-based animation
- Footer: Grid layout with proper color scheme

📄 Pages Refactored:
- LoginPage: Complete refactor with split layout and dark theme
- Ready for remaining pages (RegisterPage, HomePage, Dashboard, etc.)

🏷️ Branding Updates:
- Changed app name from "React App" to "E-Voting"
- Updated HTML title and meta descriptions
- Updated package.json with proper naming

📚 Documentation (4 comprehensive guides):
- THEME_IMPLEMENTATION_GUIDE.md: How-to for remaining pages
- SHADCN_QUICK_REFERENCE.md: Component API reference
- FRONTEND_REFACTOR.md: Complete technical overview
- DEPENDENCY_FIX_NOTES.md: Dependency resolution details

 Build Status:
- npm install: 1397 packages 
- npm run build: Success (118.95 kB gzipped)
- Zero critical errors
- Ready for production deployment

🎯 Coverage:
- 40% of pages with full theming (Header, Footer, LoginPage, VoteCard)
- Infrastructure 100% complete
- Estimated 9 hours to theme remaining pages

🔄 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 16:34:43 +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
4b3da56c40 docs: Add comprehensive documentation (PROJECT_STRUCTURE, QUICK_START) and cleanup
- Remove old STATUS.md and STRUCTURE_NOTES.md
- Add detailed PROJECT_STRUCTURE.md with full architecture documentation
- Add QUICK_START.md with quick reference guide
- Documentation covers: project overview, file structure, database models, API routes, Docker setup, authentication flow, security, and deployment
2025-11-06 01:20:57 +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
15a52af587 Remove liboqs-python: use optional import for PQC compatibility 2025-11-05 18:05:56 +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