How buvindus/cs3053-mfa-gallifrey works
Gallifrey combines an accessible Android authenticator, a demonstration relying-party website, and a separate authentication API. The user workflow is: a website login starts a bound MFA request; the enrolled phone retrieves and approves or denies it using haptic-pattern interaction and device signing; the website checks and redeems the one-time result before creating a session. The README also documents enrollment, device management, recovery, request limits, and audit-related behavior. Connections for unsampled Android and route internals are omitted where the excerpts do not establish their wiring.
Main entry points: MainActivity.kt Authenticator app · main.py Authentication service · db.py Auth database · transaction_service.py Request lifecycle
Components 28
Android authenticator
- Authenticator app
android/app/src/main/kotlin/com/gallifrey/authenticator/MainActivity.kt - Device authentication
android/app/src/main/kotlin/com/gallifrey/authenticator/device/DeviceAuthenticator.kt - Keystore signer
android/app/src/main/kotlin/com/gallifrey/authenticator/device/KeystoreDeviceSigner.kt - Practice session
android/core/src/main/kotlin/com/gallifrey/authenticator/practice/PracticeSession.kt - Haptic output
android/app/src/main/kotlin/com/gallifrey/authenticator/haptics/HapticEngine.kt - Haptic calibration
android/app/src/main/kotlin/com/gallifrey/authenticator/settings/CalibrationScreen.kt
Relying-party website
- Demo website
app/main.py - Login routes
app/routes/login.py - MFA routes
app/routes/auth.py - Pending login state
app/services/pending_login_service.py - Web sessions
app/services/session_service.py - Auth client contract
app/services/auth_service_client.py - HTTP adapter
app/services/http_auth_service.py - Mock adapter
app/services/mock_auth_service.py
Authentication API
- Authentication service
auth_service/main.py - Enrollment routes
auth_service/routes/enrollments.py - Device request routes
auth_service/routes/auth_requests.py - RP and management routes
auth_service/routes/rp_routes.py
Authentication domain
- Device enrollment
auth_service/services/enrollment_service.py - Request lifecycle
auth_service/services/transaction_service.py - Signature verification
auth_service/services/signature_service.py - Result issuance
auth_service/services/result_service.py - Audit writing
auth_service/services/audit_writer.py
Persistence
- Auth database
auth_service/db.py - Website database
app/db.py - Auth records
auth_service/models/auth_transaction.py
Other components
- Phone user
- Website user
Connections 39
- Phone user → Authenticator app: uses
- Authenticator app → Device authentication: invokes
android/app/src/main/kotlin/com/gallifrey/authenticator/MainActivity.kt - Authenticator app → Keystore signer: invokes
android/app/src/main/kotlin/com/gallifrey/authenticator/MainActivity.kt - Authenticator app → Practice session: starts
android/app/src/main/kotlin/com/gallifrey/authenticator/MainActivity.kt - Authenticator app → Haptic output: uses
android/app/src/main/kotlin/com/gallifrey/authenticator/MainActivity.kt - Authenticator app → Haptic calibration: loads settings
android/app/src/main/kotlin/com/gallifrey/authenticator/MainActivity.kt - Practice session → Haptic output: plays patterns
android/app/src/main/kotlin/com/gallifrey/authenticator/haptics/HapticEngine.kt - Website user → Demo website: visits
- Demo website → Login routes: routes to
app/main.py - Demo website → MFA routes: routes to
app/main.py - Demo website → Website database: initializes
app/main.py - Login routes → Pending login state: creates pending login
- MFA routes → Pending login state: uses
app/routes/auth.py - MFA routes → Auth client contract: requests MFA
app/routes/auth.py - MFA routes → Web sessions: creates session
app/routes/auth.py - Web sessions → Website database: persists sessions
app/services/session_service.py - Auth client contract → HTTP adapter: implemented by
app/services/http_auth_service.py - Auth client contract → Mock adapter: implemented by
app/services/mock_auth_service.py - HTTP adapter → Authentication service: calls over HTTP
- Mock adapter → Website database: uses
app/services/mock_auth_service.py - Authentication service → Auth database: initializes
auth_service/main.py - Authentication service → Enrollment routes: routes to
auth_service/main.py - Authentication service → Device request routes: routes to
auth_service/main.py - Authentication service → RP and management routes: routes to
auth_service/main.py - Enrollment routes → Device enrollment: delegates enrollment
auth_service/routes/enrollments.py - Device enrollment → Signature verification: verifies proof
auth_service/services/enrollment_service.py - RP and management routes → Request lifecycle: reads and cancels
auth_service/routes/rp_routes.py - RP and management routes → Result issuance: issues and redeems
auth_service/routes/rp_routes.py - Device request routes → Request lifecycle: handles requests
auth_service/routes/auth_requests.py - Request lifecycle → Result issuance: issues result
auth_service/services/transaction_service.py - Device enrollment → Audit writing: records events
auth_service/services/enrollment_service.py - Request lifecycle → Audit writing: records events
auth_service/services/transaction_service.py - Result issuance → Audit writing: records events
auth_service/services/result_service.py - Device enrollment → Auth database: reads and writes
auth_service/services/enrollment_service.py - Request lifecycle → Auth database: reads and writes
auth_service/services/transaction_service.py - Result issuance → Auth database: reads and writes
auth_service/services/result_service.py - Audit writing → Auth database: writes events
auth_service/services/audit_writer.py - Auth database → Auth records: registers models
auth_service/db.py - Authenticator app → Authentication service: uses enrollment and MFA API