You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement local-first authentication with PIN-based security (PBKDF2 hashing), multi-user profile support on shared devices, session auto-lock, and a Dexie v3 schema migration for the users table.
Implementation Tasks
3.2.1 — Create AuthService.ts with createUser(), authenticate(), PIN hashing via PBKDF2 (Web Crypto API), session management (src/services/AuthService.ts)
3.2.2 — Create useAuth hook with reactive auth state, current user, auto-lock timer (15 min inactive) (src/hooks/useAuth.ts)
Description
Implement local-first authentication with PIN-based security (PBKDF2 hashing), multi-user profile support on shared devices, session auto-lock, and a Dexie v3 schema migration for the
userstable.Implementation Tasks
AuthService.tswithcreateUser(),authenticate(), PIN hashing via PBKDF2 (Web Crypto API), session management (src/services/AuthService.ts)useAuthhook with reactive auth state, current user, auto-lock timer (15 min inactive) (src/hooks/useAuth.ts)LoginScreen.tsx— username + PIN entry, create account flow, user switcher (src/components/auth/LoginScreen.tsx)PinLock.tsx— lock screen overlay, PIN entry to unlock, lockout after failed attempts (src/components/auth/PinLock.tsx)ProfileEditor.tsx— edit display name, affiliation, role (src/components/auth/ProfileEditor.tsx)App.tsx— gate main UI behind login, show PinLock overlay when session is locked (src/App.tsx)userstable to Dexie schema (v3 migration) — migrate existing deviceId identity to first user (src/db/database.ts)Acceptance Criteria
userstable without breaking existing dataDependencies
Relevant Files
src/services/AuthService.ts(new)src/hooks/useAuth.ts(new)src/components/auth/LoginScreen.tsx(new)src/components/auth/PinLock.tsx(new)src/components/auth/ProfileEditor.tsx(new)src/db/database.ts— v3 migrationsrc/App.tsx— auth gatingsrc/services/DeviceService.ts— existing identity