{"ok":true,"module":"module-1-identity","meta":{"title":"Module 1 — Authentication & Identity","sourcePath":"reference/concept-platform/Platform pahse 3 mvp/Module 1","specStack":"healthcare_platform_api (FastAPI)","layers":6,"overallCompletionPct":44,"legalNote":"Layer 4 KYC is a STUB in spec — real Aadhaar/DigiLocker requires UIDAI/MeitY licensing before production.","integratedWith":"hospitalnode.in · hnorder.in — Supabase Auth + vendor KYC","updated":"June 2026"},"integration":{"layers":6,"liveLayers":0,"partialLayers":5,"gapLayers":1,"completionPct":44},"layers":[{"layer":1,"id":"entry-auth","name":"Entry point — register / login / forgot password","status":"partial","routes":[{"label":"Login","href":"/login","status":"live"},{"label":"Register","href":"/register","status":"live"},{"label":"Forgot password","href":"/forgot-password","status":"live"},{"label":"Reset password","href":"/reset-password","status":"live"}],"gaps":["No captcha after 3 failed logins (spec lockout pattern)","No 10-attempt account lock with 423 response","Role selection at register (patient/doctor/pharmacist) not aligned to spec UserRole enum","Indian phone regex / password-strength rules differ from FastAPI spec"]},{"layer":2,"id":"otp","name":"OTP verification & resend","status":"partial","routes":[{"label":"Login OTP tab","href":"/login","status":"partial"},{"label":"Supabase phone OTP","href":"/login","status":"partial"}],"gaps":["OTP purpose enum (registration/login/password_reset) not mirrored","No OTP lock after max attempts (spec otp_service)","SMS via MSG91/Gupshup not wired in hospitalnode (Supabase default)","Registration flow does not always end in otp_required before session"]},{"layer":3,"id":"onboarding","name":"Provider credential upload (doctor / pharmacist)","status":"partial","routes":[{"label":"Pharmacist / paramedic register","href":"/shop/pharmacist-register","status":"partial"},{"label":"Vendor register","href":"/vendor/register","status":"partial"},{"label":"Vendor KYC upload","href":"/vendor/kyc","status":"partial"}],"gaps":["No POST /onboarding/credentials for doctor role","License PDF magic-byte validation not shared lib with spec","pending_approval / rejected resubmit states not on profiles","S3 private bucket for credential files — local/admin manual today"]},{"layer":4,"id":"kyc-gate","name":"Patient KYC gate (Schedule H) — STUB in spec","status":"gap","routes":[{"label":"Cart compliance (Rx flag)","href":"/cart","status":"partial"},{"label":"Checkout","href":"/checkout","status":"partial"},{"label":"Module 1 status API","href":"/api/module1/status","status":"live"}],"gaps":["No GET/POST /api/kyc/status|verify for customers","No customer_kyc_records table (spec KYCRecord)","Cart can_checkout does not block on requires_kyc like Module 3 Layer 2","Real Aadhaar/DigiLocker — not started (legal licensing required)"]},{"layer":5,"id":"admin-review","name":"Admin credential review queue","status":"partial","routes":[{"label":"Admin partners KYC","href":"/admin/partners?tab=kyc","status":"partial"},{"label":"Admin KYC approve API","href":"/api/admin/kyc/[id]","status":"partial"}],"gaps":["No FIFO credential queue for doctor/pharmacist User accounts","reviewed_by audit from admin JWT name (spec Layer 6)","No NMC manual cross-check UI fields from spec","Account status flip pending_approval → active on approve not unified"]},{"layer":6,"id":"session-jwt","name":"Session / JWT & per-request account_status","status":"partial","routes":[{"label":"API auth middleware","href":"/api/profile","status":"live"},{"label":"Vendor API context","href":"/api/vendor/products","status":"live"},{"label":"Admin RBAC","href":"/admin","status":"partial"}],"gaps":["No live account_status re-fetch on every request (approved while token valid)","Role guards differ from spec require_role() matrix","15–30 min bearer expiry policy not documented in hospitalnode","Rejected doctors cannot resubmit via token without spec onboarding path"]}],"scheduleHGate":[{"gate":"requires_prescription","clearsWhen":"Every Schedule H line has approved Rx covering quantity","platformRoute":"prescription_status on order; Rx upload via Hospital AI — partial","status":"partial"},{"gate":"requires_kyc","clearsWhen":"User completed KYC once per account (stub: last-4 + consent)","platformRoute":"kycRequired flag in compliance — no patient verify API","status":"gap"},{"gate":"can_checkout","clearsWhen":"Both gates clear + stock OK + account active","platformRoute":"Checkout proceeds without KYC block","status":"gap"}],"apiMap":[{"spec":"POST /auth/register","platformRoute":"/register + Supabase signUp","status":"partial"},{"spec":"POST /auth/login","platformRoute":"/login + Supabase signIn","status":"partial"},{"spec":"POST /auth/otp/verify","platformRoute":"Supabase verifyOtp","status":"partial"},{"spec":"POST /onboarding/credentials","platformRoute":"POST /api/vendor/kyc","status":"partial"},{"spec":"GET /kyc/status","platformRoute":"— (gap)","status":"gap"},{"spec":"POST /kyc/verify","platformRoute":"— (gap)","status":"gap"},{"spec":"GET /admin/credentials/pending","platformRoute":"GET /api/admin/partners (kycQueue)","status":"partial"},{"spec":"GET /cart + gates","platformRoute":"GET /api/cart + MarketplaceCartContext","status":"partial"}],"dashboard":"/module1","patientKycApi":{"status":"gap","note":"GET/POST /api/kyc/* not implemented — vendor KYC only"}}