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