Consent-First Identity Fabric for campus events with strict RBAC, event approval workflows, consent-based PII reveal, and anonymous attendance tracking.
🚀 LowKey Secure is now live!
🔗 Visit here:
👉 LowKey Secure
LowKey Secure enables students to prove eligibility for campus events without exposing sensitive PII unless they explicitly consent. The platform implements a three-tier workflow:
| Role | Capabilities |
|---|---|
| Club Lead | Create events, request specific attributes & custom data fields, set expiry dates, view consent-based attendance |
| Admin | Review & approve/reject events based on privacy risk, manage users (edit/delete), view event history & audit trail |
| Student | View approved events filtered by year, review risk levels, give consent, dismiss unwanted events |
- Three-Tier Risk Classification — Events auto-classified as
HIGH,MEDIUM, orLOWrisk based on requested attributes and custom fields - Consent-Based PII Reveal — Club leads only see student data the student explicitly consented to share (name, email, branch, etc.)
- Anonymized Attendance — Students tracked by SHA-256 hashed tokens, not user IDs
- Centralized Privacy Engine (
privacy_engine.py) — Keyword-based risk analysis covering 40+ sensitive data patterns
- Event Approval Pipeline — Admin review queue with mandatory comments for HIGH risk and rejections
- Mandatory Expiry Dates — Every event requires an expiry date; expired events are auto-cleaned on startup and admin fetch
- Event History Tab — Admin can view all approved/rejected events with timestamps and comments
- Edit Resets to Pending — Any club lead edit automatically resets event status for re-review
- Supported Types: Short Text, Long Text, Number, Dropdown, Checkbox, Date, URL
- Auto Risk Classification — Custom field labels are analyzed against HIGH/MEDIUM/LOW risk keyword lists
- Required Field Validation — Club leads can mark fields as required; backend enforces before consent
- Auto-Generated Usernames — Random role-based username generation for students and club leads
- Profile Dialog — View your profile info from the navbar
- Admin User Management — Edit user details, delete users with full cascade cleanup (events, logs, audits, credentials)
- Delete Confirmation Dialog — Safe deletion with confirmation modal
- JWT Authentication — 24-hour token expiry with HS256 signing
- Bcrypt Password Hashing — Industry-standard password security
- RSA-256 Credential Signing — Cryptographically signed verifiable credentials
- Role-Based Access Control — Strict endpoint-level RBAC for admin, club, and student roles
| Layer | Technology |
|---|---|
| Backend | Python 3.8+, FastAPI, SQLAlchemy, SQLite |
| Auth/Crypto | python-jose (JWT), passlib + bcrypt, RSA key pairs |
| Frontend | React 19 (Vite 7), Tailwind CSS 3, Radix UI primitives |
| UI Components | Custom shadcn/ui (Badge, Button, Card, Dialog, Input, Select, Checkbox, Textarea, Label) |
| Icons | Lucide React |
| HTTP Client | Axios with interceptors (auto token injection, 401 redirect) |
- Python 3.8+
- Node.js 18+ & npm
cd backend
# Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate # macOS/Linux
# .\venv\Scripts\Activate # Windows PowerShell
# Install dependencies
pip install -r requirements.txt
# Run database migration (if upgrading existing DB)
python migrate_db.py
# Start server
uvicorn main:app --reloadBackend API: http://localhost:8000
Swagger Docs: http://localhost:8000/docs
cd frontend
# Install dependencies
npm install
# Start dev server
npm run devFrontend: http://localhost:5173
Navigate to /register and create accounts for each role:
- Admin — Must provide a custom username
- Club Lead — Provide name, email, phone, year, club/org name
- Student — Provide name, email, phone, year, branch
Usernames can be auto-generated or manually chosen for students and club leads.
- Login as Club Lead
- Fill in event name, description, and expiry date (required)
- Select allowed years (or leave empty for all years)
- Choose predefined attributes (branch, year, email, phone, name, student_id)
- Add optional custom data fields (text, dropdown, etc.)
- Review the real-time risk preview before submitting
- Login as Admin → Approvals tab
- Review each event's risk level, requested attributes, and expiry date
- Actions:
- ✅ LOW/MEDIUM risk → Approve with optional comment
- ✅ HIGH risk → Approve with mandatory justification
- ❌ Reject → Requires comment explaining reason
- Login as Student → View Available Events (filtered by year eligibility)
- Review risk badge, risk message, requested attributes, and expiry date
- Click "Give Consent" → Review details in consent modal
- Fill in any required custom fields
- Confirm → "Access Granted!" animation
- Go to My Events → Click the attendance icon on an approved event
- View Live Attendance Feed showing:
- ✅ Consented PII (only what the student agreed to share)
- 🕐 Timestamp (IST)
- 🔑 Anonymized token
- 📝 Custom field responses
LowKey-secure/
├── backend/
│ ├── main.py # FastAPI routes & endpoints
│ ├── models.py # SQLAlchemy ORM models (8 tables)
│ ├── schemas.py # Pydantic request/response schemas
│ ├── auth.py # JWT auth, bcrypt, token creation
│ ├── utils.py # RSA signing, phone/email validation
│ ├── privacy_engine.py # Centralized risk classification engine
│ ├── privacy_analytics.py # Digital Hygiene metrics logic
│ ├── ai_advisor.py # AI summary generation (Zero PII)
│ ├── username_gen.py # Random username generator
│ ├── database.py # SQLite engine & session
│ ├── migrate_db.py # Database migration script
│ └── requirements.txt
├── frontend/
│ ├── public/
│ │ └── log.png # App logo
│ ├── src/
│ │ ├── App.jsx # Router, navbar, auth guards
│ │ ├── api.js # Axios instance with interceptors
│ │ ├── main.jsx # React entry point
│ │ ├── index.css # Global styles (dark theme)
│ │ ├── context/
│ │ │ └── AuthContext.jsx # JWT decode, login/logout state
│ │ ├── components/
│ │ │ ├── ProfileDialog.jsx # User profile modal
│ │ │ ├── RiskBadge.jsx # Risk level badge component
│ │ │ └── ui/ # shadcn/ui primitives
│ │ ├── pages/
│ │ │ ├── Login.jsx
│ │ │ ├── Register.jsx
│ │ │ ├── AdminDashboard.jsx # Approvals, Users, History tabs
│ │ │ ├── ClubDashboard.jsx # Event builder & attendance
│ │ │ ├── StudentDashboard.jsx # Event feed & consent
│ │ │ └── RequestDetails.jsx
│ │ └── lib/
│ │ └── utils.js # cn() utility for Tailwind
│ └── package.json
├── README.md
└── .gitignore
| Method | Endpoint | Description |
|---|---|---|
GET |
/auth/generate-username |
Generate random username |
POST |
/auth/register |
Register new user |
POST |
/auth/login |
Login & get JWT token |
GET |
/user/profile |
Get current user profile |
| Method | Endpoint | Description |
|---|---|---|
POST |
/admin/issue-credential |
Issue credential to student |
GET |
/admin/events?status= |
Get events (PENDING/APPROVED/REJECTED) |
POST |
/admin/events/{id}/review |
Approve or reject event |
GET |
/admin/users |
List all users |
PUT |
/admin/users/{id} |
Update user details |
DELETE |
/admin/users/{id} |
Delete user (full cascade) |
GET |
/admin/credentials |
List all credentials |
| Method | Endpoint | Description |
|---|---|---|
POST |
/club/events |
Create event with attributes & custom fields |
PUT |
/club/events/{id} |
Edit event (resets to PENDING) |
DELETE |
/club/events/{id} |
Delete own event |
GET |
/club/events |
List own events |
GET |
/club/events/{id}/logs |
Consent-based attendance with custom responses |
GET |
/club/calendar |
View all approved events (read-only) |
| Method | Endpoint | Description |
|---|---|---|
GET |
/student/credentials |
Get own credentials |
GET |
/student/events |
Approved events (year-filtered) |
GET |
/student/events/{id} |
Event details (eligibility checked) |
GET |
/student/registered-events |
Events already consented to |
POST |
/student/events/{id}/consent |
Give consent with custom field responses |
| Table | Purpose |
|---|---|
users |
All users (admin, club, student) with PII fields |
credentials |
RSA-signed verifiable credentials |
access_requests |
Events with attributes, risk level, status, expiry |
approval_audits |
Admin approve/reject actions with comments |
access_logs |
Anonymized attendance with consented attributes |
user_audits |
User modification tracking |
event_custom_fields |
Dynamic form fields per event |
student_custom_field_responses |
Student answers to custom fields |
student_privacy_metrics |
New: Aggregated monthly exposure stats |
| Level | Triggers | Admin Requirement |
|---|---|---|
| HIGH | phone, student_id, aadhaar, passport, bank details, biometrics | Mandatory justification comment |
| MEDIUM | name, email, social media, DOB, gender | Optional comment |
| LOW | branch, year, t-shirt size, preferences | Optional comment |
- When a student consents to an event, the system stores which attributes they agreed to share (
consented_attrs) - Club leads viewing attendance logs only see the data fields the student consented to — no more, no less
- Attribute mapping ensures frontend names resolve to correct database columns (
student_id→username, etc.)
- Access logs use SHA-256 hashed tokens (
user_id + event_id + timestamp) - Deduplication check prevents multiple registrations per student per event
- Expired events are automatically purged on server startup
A dedicated privacy dashboard for students to monitor their data exposure footprint. This feature shifts the focus from "access" to "behavioral privacy."
- Exposure Score: A cumulative weighted score calculated from all attended events.
- Formula:
(High_Risk_Count * 6) + (Medium_Risk_Count * 3) + (Low_Risk_Count * 1)
- Formula:
- Entropy Score: Measures how widely your data is spread across different organisations. High entropy means your data is fragmented across many clubs (higher breach risk).
- Risk Velocity: Tracks the rate of change in your risk exposure compared to the previous month. A spike (e.g., +15 points) triggers an alert.
The dashboard includes an AI-generated summary that provides actionable advice (e.g., "Your risk exposure doubled this month due to 3 high-risk hackathons. Consider using a burner email.").
Privacy Guarantee: The AI model (Llama-3 via Groq) receives ONLY aggregated integers (e.g., "High Risk Count: 5"). No raw PII, names, or event titles are ever sent to the AI.
- Database: SQLite (
backend/lowkey.db) — auto-created on first run - RSA Keys: Auto-generated and persisted (
private_key.pem,public_key.pem) - Timezone: IST (Asia/Kolkata, UTC+5:30) — timestamps stored as naive IST
- Notifications: Simulated via server console logs
- Token Expiry: JWT tokens valid for 24 hours