# miles-howell/vixxing architecture

> Architecture diagram of the GitHub repository miles-howell/vixxing, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/miles-howell/vixxing
- Repository: https://github.com/miles-howell/vixxing

## Overview

#### Purpose and Entry Points
Vixxing is an internal Django tool for help-desk agents to verify callers through RFC 6238 TOTP before account-recovery actions. The Django project is run from `TOTP/manage.py`; the staff dashboard is rooted at `/`, while Django admin manages staff and employee records at `/admin/`.
- `TOTP/manage.py`
- `TOTP/TOTP/urls.py`
- `TOTP/verify/urls.py`

#### Application Composition
The `verify` Django app owns the operational workflow: employee lookup, enrollment, verification, lifecycle actions, CSV import/export, and bulk actions. Its views are staff-gated, so there is no employee self-service or public caller endpoint.
- `TOTP/verify/views.py`
- `TOTP/verify/urls.py`
- `TOTP/verify/templates/verify/dashboard.html`

#### Identity and Persistence Boundary
Django authentication supplies agent accounts and staff authorization. Employee MFA state is persisted through the ORM, associating employee identities with a TOTP secret and enrollment state; migrations establish that schema. SQLite is the default datastore, but Django permits another relational backend.
- `TOTP/verify/models.py`
- `TOTP/verify/migrations/0001_initial.py`
- `TOTP/verify/admin.py`

#### Core Verification Flow
An agent finds an employee on the dashboard, submits the live six-digit authenticator value, and the server verifies it against the employee’s stored secret with PyOTP’s time-window behavior. The result is returned to the agent-facing dashboard as the decision boundary for downstream help-desk actions; this application does not itself reset accounts.
- `TOTP/verify/views.py`
- `TOTP/verify/templates/verify/dashboard.html`
- `TOTP/verify/models.py`

#### Enrollment and Secret Rotation
Enrollment and regeneration generate a new base32 secret, construct an `otpauth://` provisioning URI, render a QR image, and send it to the employee. Rotation invalidates the prior secret; unenrollment clears MFA state while retaining the employee, and deletion removes the employee record. QR-bearing message bodies and attachments are rendered from dedicated email templates.
- `TOTP/verify/views.py`
- `TOTP/verify/templates/verify/enrollment_email.html`
- `TOTP/verify/templates/verify/enrollment_email.txt`

#### Batch Management and Data Exposure
The dashboard supports employee creation, CSV import, search, selected-row bulk enrollment/unenrollment/deletion, and CSV export. Import creates identities without enrollment; export intentionally excludes TOTP secrets. Confirmation behavior is implemented in the dashboard UI for destructive operations.
- `TOTP/verify/views.py`
- `TOTP/verify/templates/verify/dashboard.html`

#### Runtime, Delivery, and Deployment
Django settings configure installed apps, database, static delivery, security settings, and named mailers. Enrollment email prefers Microsoft Graph via `django-msgraphbackend`, with SMTP fallback when configured. Python 3.12+ is required; development uses Django’s server, while longer-lived WSGI deployment is intended for Gunicorn behind an internal reverse proxy. ASGI is also exposed but not presented as the primary deployment path.
- `TOTP/TOTP/settings.py`
- `TOTP/TOTP/wsgi.py`
- `TOTP/TOTP/asgi.py`

#### Security and Operational Boundary
The system is explicitly LAN/internal-network scoped. Secrets and QR enrollment material require protected transport and email handling; shipped cookie settings do not assume HTTPS. Environment-provided Django, Graph/Entra, SMTP, and host configuration separates deployment credentials from source.
- `TOTP/.env.example`
- `TOTP/TOTP/settings.py`
- `requirements.txt`

Main entry points: [`TOTP/verify/views.py`](https://github.com/miles-howell/vixxing/blob/main/TOTP/verify/views.py) (Staff-gated views), [`TOTP/verify/models.py`](https://github.com/miles-howell/vixxing/blob/main/TOTP/verify/models.py) (Employee MFA model), [`TOTP/TOTP/settings.py`](https://github.com/miles-howell/vixxing/blob/main/TOTP/TOTP/settings.py) (Django settings), [`TOTP/verify/templates/verify/dashboard.html`](https://github.com/miles-howell/vixxing/blob/main/TOTP/verify/templates/verify/dashboard.html) (Staff dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Staff Access"]
  node_agent(("Help-desk agent<br/>user"))
  node_dashboard["Staff dashboard<br/>Django template UI<br/>[dashboard.html]"]
  node_project_urls["Project routes<br/>Django URL config<br/>[urls.py]"]
end

subgraph group_workflow["Verification Workflow"]
  node_verify_urls["Verification routes<br/>Django URL config<br/>[urls.py]"]
  node_views["Staff-gated views<br/>Django views<br/>[views.py]"]
  node_totp["PyOTP verification<br/>RFC 6238 TOTP"]
  node_enrollment["Enrollment &amp; rotation<br/>provisioning flow<br/>[views.py]"]
  node_email_templates["Enrollment email templates<br/>HTML and text templates"]
end

subgraph group_persistence["Identity &amp; Data"]
  node_auth["Django staff auth<br/>authentication boundary"]
  node_employee_model["Employee MFA model<br/>Django ORM model<br/>[models.py]"]
  node_database[("Relational datastore<br/>SQLite by default")]
  node_admin["Django admin<br/>admin registration<br/>[admin.py]"]
end

subgraph group_delivery["Runtime &amp; Delivery"]
  node_settings["Django settings<br/>runtime configuration<br/>[settings.py]"]
  node_mail_delivery["Enrollment mail delivery<br/>Graph with SMTP fallback"]
  node_wsgi["WSGI deployment<br/>Gunicorn entry point<br/>[wsgi.py]"]
  node_environment["Deployment environment<br/>environment configuration<br/>[.env.example]"]
end

node_agent -->|"uses"| node_dashboard
node_project_urls -->|"includes"| node_verify_urls
node_verify_urls -->|"dispatches"| node_views
node_dashboard -->|"submits workflow actions"| node_views
node_views -->|"requires staff access"| node_auth
node_views -->|"looks up and changes"| node_employee_model
node_employee_model -->|"persists through ORM"| node_database
node_views -->|"verifies submitted code"| node_totp
node_totp -->|"uses stored secret"| node_employee_model
node_views -->|"enrolls or regenerates"| node_enrollment
node_enrollment -->|"stores or replaces secret"| node_employee_model
node_enrollment -->|"renders QR message"| node_email_templates
node_email_templates -->|"sends enrollment email"| node_mail_delivery
node_settings -->|"configures backend"| node_database
node_settings -->|"configures mailers"| node_mail_delivery
node_environment -.->|"supplies deployment values"| node_settings
node_wsgi -->|"loads application settings"| node_settings
node_admin -->|"administers records"| node_employee_model

click node_dashboard "https://github.com/miles-howell/vixxing/blob/main/TOTP/verify/templates/verify/dashboard.html"
click node_project_urls "https://github.com/miles-howell/vixxing/blob/main/TOTP/TOTP/urls.py"
click node_verify_urls "https://github.com/miles-howell/vixxing/blob/main/TOTP/verify/urls.py"
click node_views "https://github.com/miles-howell/vixxing/blob/main/TOTP/verify/views.py"
click node_enrollment "https://github.com/miles-howell/vixxing/blob/main/TOTP/verify/views.py"
click node_email_templates "https://github.com/miles-howell/vixxing/blob/main/TOTP/verify/templates/verify/enrollment_email.html"
click node_employee_model "https://github.com/miles-howell/vixxing/blob/main/TOTP/verify/models.py"
click node_admin "https://github.com/miles-howell/vixxing/blob/main/TOTP/verify/admin.py"
click node_settings "https://github.com/miles-howell/vixxing/blob/main/TOTP/TOTP/settings.py"
click node_wsgi "https://github.com/miles-howell/vixxing/blob/main/TOTP/TOTP/wsgi.py"
click node_environment "https://github.com/miles-howell/vixxing/blob/main/TOTP/.env.example"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_agent,node_dashboard,node_project_urls toneBlue
class node_verify_urls,node_views,node_totp,node_enrollment,node_email_templates toneAmber
class node_auth,node_employee_model,node_database,node_admin toneMint
class node_settings,node_mail_delivery,node_wsgi,node_environment toneRose
```

## Components

### Staff Access

- **Help-desk agent**: user · Internal staff user performing recovery verification.
- [Staff dashboard](https://github.com/miles-howell/vixxing/blob/main/TOTP/verify/templates/verify/dashboard.html): Django template UI · Employee search, verification, enrollment, and batch-management interface. · `TOTP/verify/templates/verify/dashboard.html`
- [Project routes](https://github.com/miles-howell/vixxing/blob/main/TOTP/TOTP/urls.py): Django URL config · Routes the root dashboard and Django admin. · `TOTP/TOTP/urls.py`

### Verification Workflow

- [Verification routes](https://github.com/miles-howell/vixxing/blob/main/TOTP/verify/urls.py): Django URL config · `TOTP/verify/urls.py`
- [Staff-gated views](https://github.com/miles-howell/vixxing/blob/main/TOTP/verify/views.py): Django views · Owns lookup, verification, enrollment, lifecycle, CSV, and bulk workflows. · `TOTP/verify/views.py`
- **PyOTP verification**: RFC 6238 TOTP · Checks a submitted six-digit code against the stored secret and time window.
- [Enrollment & rotation](https://github.com/miles-howell/vixxing/blob/main/TOTP/verify/views.py): provisioning flow · Generates a base32 secret, otpauth URI, and QR material. · `TOTP/verify/views.py`
- [Enrollment email templates](https://github.com/miles-howell/vixxing/blob/main/TOTP/verify/templates/verify/enrollment_email.html): HTML and text templates · Render QR-bearing enrollment messages and attachments. · `TOTP/verify/templates/verify/enrollment_email.html`

### Identity & Data

- **Django staff auth**: authentication boundary · Supplies agent accounts and staff authorization.
- [Employee MFA model](https://github.com/miles-howell/vixxing/blob/main/TOTP/verify/models.py): Django ORM model · Associates employee identity with TOTP secret and enrollment state. · `TOTP/verify/models.py`
- **Relational datastore**: SQLite by default · Django ORM persistence; another relational backend may be used.
- [Django admin](https://github.com/miles-howell/vixxing/blob/main/TOTP/verify/admin.py): admin registration · Manages staff and employee records at /admin/. · `TOTP/verify/admin.py`

### Runtime & Delivery

- [Django settings](https://github.com/miles-howell/vixxing/blob/main/TOTP/TOTP/settings.py): runtime configuration · Configures apps, database, security, static delivery, and named mailers. · `TOTP/TOTP/settings.py`
- **Enrollment mail delivery**: Graph with SMTP fallback · Prefers Microsoft Graph through django-msgraphbackend.
- [WSGI deployment](https://github.com/miles-howell/vixxing/blob/main/TOTP/TOTP/wsgi.py): Gunicorn entry point · Intended for long-lived deployment behind an internal reverse proxy. · `TOTP/TOTP/wsgi.py`
- [Deployment environment](https://github.com/miles-howell/vixxing/blob/main/TOTP/.env.example): environment configuration · Provides Django, Graph/Entra, SMTP, and host credentials. · `TOTP/.env.example`

## Connections

- Help-desk agent → Staff dashboard: uses
- Project routes → Verification routes: includes
- Verification routes → Staff-gated views: dispatches
- Staff dashboard → Staff-gated views: submits workflow actions
- Staff-gated views → Django staff auth: requires staff access
- Staff-gated views → Employee MFA model: looks up and changes
- Employee MFA model → Relational datastore: persists through ORM
- Staff-gated views → PyOTP verification: verifies submitted code
- PyOTP verification → Employee MFA model: uses stored secret
- Staff-gated views → Enrollment & rotation: enrolls or regenerates
- Enrollment & rotation → Employee MFA model: stores or replaces secret
- Enrollment & rotation → Enrollment email templates: renders QR message
- Enrollment email templates → Enrollment mail delivery: sends enrollment email
- Django settings → Relational datastore: configures backend
- Django settings → Enrollment mail delivery: configures mailers
- Deployment environment → Django settings: supplies deployment values
- WSGI deployment → Django settings: loads application settings
- Django admin → Employee MFA model: administers records
