This repository presents an open-source Workplace Intelligence Platform with Hybrid Face–QR Authentication that combines secure visitor management with comprehensive workspace analytics. The system implements a Hybrid Face–QR Visitor Authentication Protocol (HFQVAP) that binds a per-visit QR token to biometric face verification through a five-state QR lifecycle with automatic invalidation on misuse. Beyond access control, the platform provides real-time building occupancy tracking, meeting room optimization, predictive visitor pattern analytics, and workspace utilization insights.
Unlike commercial solutions (Envoy, Proxyclick) that are proprietary and cloud-based, this platform is fully open-source, self-hosted, and research-focused—making it ideal for academic institutions and privacy-conscious organizations. The system is configurable across three protocol variants (hybrid, face-only, QR-only) under the same deployment, enabling direct comparison of security properties. All gate events are logged with protocol metadata for post-hoc analysis and workspace intelligence.
Modern organizations face dual challenges: ensuring secure visitor access control while optimizing workspace utilization. Traditional visitor management systems present three key limitations:
-
Security Gaps: Single-factor authentication (QR-only or face-only) leaves specific threats unaddressed:
- QR-only: Any holder of the QR image can authenticate. A credential stolen inside the premises can be reused at departure.
- Face-only: Visually similar individuals (twins, look-alikes) produce ambiguous matches without secondary verification.
-
Proprietary Constraints: Commercial solutions lack transparency, customization, and self-hosting options critical for research and privacy-sensitive deployments.
-
Limited Intelligence: Most systems focus solely on access control without providing workspace optimization insights such as occupancy analytics, room utilization, and predictive patterns.
This work investigates whether a hybrid protocol — cross-verifying face and QR with a token state machine and invalidation rules — addresses security weaknesses while simultaneously providing actionable workspace intelligence for building optimization.
-
Hybrid Authentication Protocol (HFQVAP). A hybrid face–QR authentication protocol with a five-state QR lifecycle (UNUSED, CHECKIN_USED, ASSUMED_SCANNED, CHECKOUT_USED, INVALIDATED), defined transition rules, and six operational invariants.
-
Workspace Intelligence Module. Real-time building occupancy tracking, meeting room optimization with AI-powered suggestions, predictive visitor pattern analytics, and workspace utilization insights integrated directly into the visitor management workflow.
-
Threat Analysis. A qualitative threat model covering six categories (QR theft, QR replay, face spoofing, no-departure, post-entry QR theft, twin ambiguity) with per-threat comparison across all three variants. Limitations — notably liveness detection and tailgating — are explicitly scoped out.
-
Open-Source Platform. A fully open-source, self-hosted solution with comprehensive documentation, enabling research, customization, and privacy-conscious deployments without vendor lock-in.
-
Comparative Evaluation Framework. A single codebase supporting three authentication modes (
hybrid,face_only,qr_only) switchable via environment variable, with structured event logging (auth_mode,protocol_config) for reproducible comparison.
├── docs/
│ ├── SETUP_GUIDE.md # Full setup instructions
│ └── TEST_PLAN.md # End-to-end test plan with all edge cases
├── registration/ # Visitor registration, QR issuance, host approval
│ ├── app.py # Flask (Port 5001)
│ └── templates/
├── admin/ # Dashboard, analytics, access-control list
│ ├── app.py # Flask (Port 5000)
│ └── templates/
└── gate/ # Gate — protocol engine (AUTH_MODE configurable)
├── app.py # Flask (Port 5002)
├── qr_module.py # QR generation, validation, state machine
└── templates/
| Component | Responsibility |
|---|---|
| registration | Visitor pre-registration, face embedding capture (dlib ResNet, 128-D), per-visit QR token generation (secrets.token_urlsafe(32), JSON-encoded, visit-bound), host approval workflow, meeting room selection. |
| admin | Visitor and employee management, blacklist enforcement, feedback sentiment analysis, comprehensive visit analytics, real-time occupancy dashboard, meeting room management, predictive analytics, workspace intelligence insights. |
| gate | Gate endpoint implementing the three protocol variants: face matching, QR parsing and state management, cross-verification, invalidation logic, structured event logging, and occupancy tracking. |
Data is persisted in Firebase Realtime Database. All three components share the same database instance, enabling real-time synchronization of visitor data, occupancy metrics, and workspace analytics.
The gate supports three modes selected via AUTH_MODE:
| Variant | Value | Gate behavior | QR state machine |
|---|---|---|---|
| Hybrid | hybrid |
Face match + QR validation; cross-verification that both identify the same visitor. | Active: full lifecycle with invalidation on mismatch and stolen-QR detection. |
| Face-only | face_only |
Face match only; QR data ignored. | Inactive: no state updates. |
| QR-only | qr_only |
Valid QR token only; face not required. | Partial: token validated (expiry, state) but no face cross-check. |
The hybrid variant enforces six invariants: dual binding (face and QR must agree), single use per phase, mismatch invalidation, stolen-QR detection (face-only departure after QR arrival), blacklist enforcement, and token expiry. These invariants are enforced at the gate layer.
- Live Building Occupancy: Real-time count of visitors currently in the building
- Hourly Distribution: Track visitor patterns throughout the day
- Peak Time Identification: Automatically identify busiest hours
- Occupancy Trends: Visualize occupancy patterns over time
- Room Database: Manage meeting rooms with capacity, floor, and amenities
- AI-Powered Suggestions: Automatically suggest optimal rooms based on visitor count
- Room Utilization Analytics: Track which rooms are most used
- Capacity Matching: Match visitor groups to appropriately sized rooms
- Availability Tracking: Monitor room usage patterns
- Peak Time Prediction: Forecast busy hours for the next week based on historical patterns
- Visitor Volume Forecasting: Predict expected visitor counts by day
- Day-of-Week Patterns: Identify recurring patterns (e.g., "Tuesdays are busiest")
- Trend Analysis: Analyze visitor patterns over time
- Department Analytics: Track which departments receive most visitors
- Purpose Distribution: Analyze visit purposes (meetings, interviews, deliveries, etc.)
- Time-Based Trends: Understand visitor patterns by hour, day, week, month
- Resource Utilization: Identify underutilized or overutilized spaces
- Comprehensive Metrics: Total visitors, active visitors, completed visits, time exceeded alerts
- Interactive Charts: Purpose distribution, status overview, department-wise analysis, hourly trends
- Custom Time Filters: Analyze data for today, this week, this month, custom date ranges
- Real-Time Updates: Live dashboard updates with latest visitor data
Six threat categories are analyzed:
| Threat | Face-only | QR-only | Hybrid |
|---|---|---|---|
| T1. QR theft / sharing | N/A | Vulnerable | Mitigated (face–QR binding) |
| T2. QR replay | N/A | Mitigated (expiry + state) | Mitigated (expiry + state) |
| T3. Face spoofing | Out of scope (liveness assumption) | N/A | Same as face-only |
| T4. No departure | Operational (audit only) | Operational (audit only) | Operational (audit only) |
| T5. Post-entry QR theft | N/A | Vulnerable | Mitigated (invalidation on face-only departure) |
| T6. Twin / ambiguous face | Vulnerable | N/A | Mitigated (QR disambiguation) |
The hybrid variant addresses T1, T5, and T6 relative to the single-factor baselines. T3 (face spoofing) is an explicit non-goal: liveness detection is orthogonal to the protocol and is noted as an assumption. T4 (no departure) is operational and not mitigated by any variant.
| Property | Procedure | Applicable variants |
|---|---|---|
| Replay resistance | Resubmit a previously used QR; verify state-machine rejection. | QR-only, hybrid |
| Impersonation detection | Present a valid QR with a non-matching face; verify denial and QR invalidation. | Hybrid |
| Stolen-credential detection | Use QR at arrival, face-only at departure; verify QR invalidation and security alert. | Hybrid |
| Twin disambiguation | Present two visitors within the face-distance ambiguity threshold; verify QR-based resolution. | Face-only vs. hybrid |
| Gate response time | Measure time from HTTP request to response under each variant. | All |
| Firebase path | Contents |
|---|---|
research_protocol_events/ |
Arrival, departure, and invalidation events with auth_mode, protocol_config, timestamp, visitor_id, visit_id. |
visitors/{id}/visits/{id}/qr_state |
QR state snapshot: status, scan_count, auth_method, invalidated_at, invalidated_reason. |
visitors/{id}/visits/{id}/qr_scan_log/ |
Chronological scan events: scan_type, auth_mode, ip, face_distance. |
visitors/{id}/transactions/ |
Per-action log: action, auth_mode, face_distance, timestamp. |
security_alerts/ |
Alert records: alert_type (QR_FACE_MISMATCH, QR_POSSIBLY_STOLEN, TWIN_DETECTED). |
- Deploy the gate under each
AUTH_MODEin sequence or on parallel instances. - Execute a fixed set of scenarios: normal visit, QR reuse, QR presented by wrong person, face-only departure after QR arrival, twin presentation.
- Export
research_protocol_eventsandsecurity_alertsfrom Firebase (console, REST API, or SDK). - Compare across variants: (a) threat detection coverage, (b) false rejection of legitimate visitors, (c) response latency.
AUTH_MODE=hybrid python gate/app.py # default
AUTH_MODE=face_only python gate/app.py # baseline A
AUTH_MODE=qr_only python gate/app.py # baseline BAlternatively, set AUTH_MODE in gate/.env. The active mode is validated and logged at startup.
- Protocol events:
research_protocol_events/— each record includesprotocol_config(which mode was active). - QR state:
visitors/{id}/visits/{id}/qr_stateandqr_scan_log/. - Security alerts:
security_alerts/at database root.
- Python 3.8+
- Firebase Realtime Database credentials (
firebase_credentials.json) - Camera or uploaded images for face registration
- Pre-trained models (included):
shape_predictor_68_face_landmarks.dat,dlib_face_recognition_resnet_model_v1.dat,sentiment_analysis.pkl,genderage.onnx
python3 -m venv venv && source venv/bin/activate
pip install -r registration/requirements.txt
pip install -r admin/requirements.txt
pip install -r gate/requirements.txtdlib requires CMake and platform libraries (sudo apt-get install cmake libopenblas-dev liblapack-dev on Debian/Ubuntu). See dlib.net or use conda install -c conda-forge dlib. Full setup instructions in docs/SETUP_GUIDE.md.
Create .env in each component directory:
registration/.env:
SECRET_KEY=<secret>
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587
EMAIL_USER=<email>
EMAIL_PASS=<app_password>
GEMINI_API_KEY=<key>
ADMIN_APP_URL=http://localhost:5000
(ADMIN_APP_URL is used to fetch meeting rooms for the registration dropdown.)
admin/.env:
SECRET_KEY=<secret>
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587
EMAIL_USER=<email>
EMAIL_PASS=<app_password>
REGISTRATION_APP_URL=http://localhost:5001
gate/.env:
SECRET_KEY=<secret>
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587
EMAIL_USER=<email>
EMAIL_PASS=<app_password>
COMPANY_IP=127.0.0.1
AUTH_MODE=hybrid
cd registration && python app.py # Port 5001
cd admin && python app.py # Port 5000
cd gate && python app.py # Port 5002Place firebase_credentials.json in each component directory before starting.
When demoing the system (e.g. Register + Gate in real time with fresh visitors):
- Register & Gate: Use real Firebase (no mock). Register a new visitor with face scan, get approved, then check in/out at the gate so the flow is live.
- Admin dashboard: Run Admin with
USE_MOCK_DATA=True(default). The dashboard then shows rich, stable mock data (visitors, analytics, blacklist, occupancy) so you can showcase all features (filters, search, blacklist, analytics, room management) without pre-populating real data. Mock data is fixed per server run so it does not change on every refresh. - Admin automated tests (mock): From
admin/, runpython -m unittest tests.test_admin_dashboard_mock -v. This forces mock mode for the test process; keepUSE_MOCK_DATA=Trueinadmin/.env(or unset) when running the server the same way. - Admin manual QA: Use docs/TEST_PLAN.md Phase 9 in the browser. With mock data, listed visitors are generated (not live Firebase registrations); blacklist notification email only sends if SMTP is configured in
admin/.env. - Optional: To show the same visitors you just registered in the dashboard, run Admin with
USE_MOCK_DATA=Falseand use the same Firebase project; the dashboard will read live data from Firebase.
- ✅ Hybrid Face-QR Authentication Protocol (HFQVAP)
- ✅ Three authentication modes (hybrid, face-only, QR-only)
- ✅ Automatic QR invalidation on misuse
- ✅ Twin disambiguation via QR verification
- ✅ Comprehensive threat model and security alerts
- ✅ Blacklist management
- ✅ Real-time building occupancy tracking
- ✅ Meeting room optimization and suggestions
- ✅ Predictive visitor pattern analytics
- ✅ Room utilization insights
- ✅ Department-wise visitor analytics
- ✅ Peak time predictions
- ✅ Visitor registration with face capture
- ✅ QR code generation and management
- ✅ Host approval workflow
- ✅ Check-in/check-out automation
- ✅ Visitor feedback and sentiment analysis
- ✅ Bulk invitation system
- ✅ Comprehensive analytics dashboard
- ✅ Custom time range filters
- ✅ Interactive charts and visualizations
- ✅ Export capabilities
- ✅ Real-time data updates
- Liveness detection is not implemented. The threat model assumes face spoofing is handled by an orthogonal mechanism and explicitly scopes it out (T3).
- Tailgating / no-departure (T4) is an operational concern not addressed by any of the three protocol variants; the system provides audit logs but no automatic mitigation.
- Face recognition accuracy depends on dlib's pre-trained ResNet model and the quality of registered embeddings. The protocol evaluation focuses on the authentication logic, not on the underlying biometric performance.
- QR token security relies on
secrets.token_urlsafe(32)for generation and HTTPS for transport in deployment. The protocol does not introduce novel cryptographic constructions.
- Predictive models use simple time series analysis (moving average, linear regression). Machine learning models could enhance accuracy.
- Room optimization doesn't include real-time booking system integration (suggestions only).
- Occupancy tracking is limited to visitors; employee presence is not tracked.
- Multi-gate support requires additional configuration for building-wide occupancy.
- The system was tested in a single-gate, single-database configuration. Multi-gate or federated deployments are not evaluated.
- Firebase dependency (could support other databases in future).
- No mobile app (web-based interface only).
This project is provided for academic and research purposes. If you use it in production or for access control:
- Production checklist: Use HTTPS, replace all default
SECRET_KEYvalues, restrict Firebase credentials, and run behind a proper WSGI server (e.g. Gunicorn). See Security Notes below. - No warranty: The software is provided “as is” without warranty of any kind. Use at your own risk. The maintainers are not liable for any loss or damage arising from its use.
- Replace default
SECRET_KEYvalues before any non-local deployment. - Do not commit
firebase_credentials.jsonto version control. - Use HTTPS in production to protect QR tokens in transit.
| Feature | Our Platform | Envoy | Proxyclick/Eptura |
|---|---|---|---|
| Open-source | ✅ Yes | ❌ No | ❌ No |
| Self-hosted | ✅ Yes | ❌ No | |
| Hybrid Protocol | ✅ Yes (HFQVAP) | ❌ No | |
| Workspace Intelligence | ✅ Yes | ✅ Yes | |
| Real-time Occupancy | ✅ Yes | ✅ Yes | |
| Room Optimization | ✅ Yes | ✅ Yes | |
| Predictive Analytics | ✅ Yes | ✅ Yes | ❌ No |
| Research Focus | ✅ Yes | ❌ No | ❌ No |
| Cost | Free | $5-20/visitor | $8-15/visitor |
| Customization | ✅ Fully customizable | ❌ Limited | ❌ Limited |
| Privacy | ✅ Full data control |
- Academic Institutions: Research-focused visitor management with full data control
- Privacy-Conscious Organizations: Self-hosted solution with no vendor lock-in
- Small to Medium Businesses: Cost-effective alternative to expensive SaaS platforms
- Research Labs: Open-source platform for authentication protocol research
- Government/Healthcare: Privacy-sensitive deployments requiring on-premise solutions
- Machine learning models for enhanced visitor pattern prediction
- Real-time room booking system integration
- Employee presence tracking (WiFi/access card integration)
- Mobile app (iOS/Android)
- Calendar system integration (Google Calendar, Outlook)
- Slack/Teams notifications
- Multi-gate synchronization
- Energy consumption correlation with occupancy
This project is provided for academic and research purposes.