## Problems 1. **Password is unused after signup**: We collect a password during registration but login uses API keys only. The password serves no purpose post-signup. 2. **API key emailed to user (insecure)**: On admin approval, the API key is sent via email. Email is not a secure channel for secrets. 3. **No API key regeneration**: Users cannot regenerate their API key if compromised or lost. ## Proposed Changes ### Phase 1: Secure API key delivery - [ ] Stop emailing the API key to users - [ ] On approval, send email notifying user they are approved with instructions to retrieve their key - [ ] Add `POST /auth/retrieve-key` endpoint: user provides email + password -> if approved, returns API key (one-time display) - [ ] Password is now only used for this key retrieval step ### Phase 2: API key regeneration - [ ] Add `POST /auth/regenerate-key` endpoint - [ ] Flow: user requests regeneration -> email verification sent -> user confirms -> old key revoked, new key generated - [ ] CLI command: `nemar auth regenerate-key` that triggers the flow - [ ] Requires email re-verification for security ### Phase 3: Consider removing password entirely - [ ] If key retrieval can be done via email verification link instead of password, password becomes fully unnecessary - [ ] Evaluate removing password from signup to simplify onboarding ## Current Implementation - Signup: `backend/src/routes/auth.ts` (collects password, hashes with bcrypt) - Approval + email: `backend/src/routes/admin.ts` (generates key, emails it) - Email service: `backend/src/services/email.ts` (sends approval email with API key) - Login: API key only, no password check ## Acceptance Criteria - API keys are never sent via email - Users can securely retrieve their API key after approval - Users can regenerate compromised API keys with email verification
Activity
Secure auth flow: stop emailing API keys, add key retrieval
Secure auth flow: stop emailing API keys, add retrieval (#143)
PR review workflow: install after the mint without scripts; timeout 2…