How ezioauditore027/crypto-secure-model-service works
This is a secure ML model-serving application: users register, receive approval, establish a KEM-based encrypted session, submit classification queries, and may send feedback; administrators manage access and retrain the classifier. The HTTP API dispatches operations to a central service, which coordinates session security, inference, feedback, and persistence. The graph also preserves the documented web and CLI clients, classical KEM fallback, and feedback-driven model rebuilding. Some UI-to-API wiring and unsampled service operations are documented but not shown in excerpts, so those links are marked unverified.
Main entry points: service.py Service Manager · app.py HTTP API · channel.py Secure Session · run_user.py User CLI
Components 15
User and Admin Clients
- User Web Portal
web/user.html - Admin Web Portal
web/admin.html - User CLI
run_user.py - Admin CLI
run_admin.py
HTTP and Orchestration
- HTTP API
server/app.py - Service Manager
server/service.py
Secure Channel
- KEM Algorithms
crypto/kem.py - Secure Session
crypto/channel.py - HKDF
crypto/kdf.py - ChaCha20-Poly1305
crypto/aead.py
ML and Persistence
- Training and Feedback Data
ml/dataset.py - Classifier and Retraining
ml/model.py - SQLite State
server/database.py
Other components
- Authorized User
- Owner / Admin
Connections 24
- Authorized User → User Web Portal: uses
README.md - Authorized User → User CLI: uses
README.md - Owner / Admin → Admin Web Portal: uses
README.md - Owner / Admin → Admin CLI: uses
README.md - User Web Portal → HTTP API: calls API
- Admin Web Portal → HTTP API: calls API
- User CLI → HTTP API: sends requests
run_user.py - Admin CLI → HTTP API: calls API
- HTTP API → Service Manager: dispatches
server/app.py - Service Manager → SQLite State: reads and writes
server/service.py - Service Manager → KEM Algorithms: selects and uses
server/service.py - Service Manager → Secure Session: manages sessions
server/service.py - Service Manager → Classifier and Retraining: runs inference
server/service.py - Service Manager → Training and Feedback Data: loads training data
server/service.py - Service Manager → SQLite State: stores feedback
server/service.py - Service Manager → Classifier and Retraining: rebuilds classifier
server/service.py - Secure Session → HKDF: derives keys
crypto/channel.py - Secure Session → ChaCha20-Poly1305: encrypts and decrypts
crypto/channel.py - KEM Algorithms → HKDF: derives shared key
crypto/kem.py - SQLite State → Classifier and Retraining: stores model blob
- User CLI → KEM Algorithms: encapsulates key
run_user.py - User CLI → Secure Session: creates session
run_user.py - HTTP API → Secure Session: parses secure packet
server/app.py - Service Manager → Secure Session: encrypts response
server/service.py