Skip to content

Secure auth flow: stop emailing API keys, add retrieval - #143

Merged
neuromechanist merged 2 commits into
devfrom
feature/issue-140-secure-auth-flow
Feb 13, 2026
Merged

neuromechanist merged 2 commits into
devfrom
feature/issue-140-secure-auth-flow

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

  • API keys are no longer sent via email (security improvement)
  • New POST /auth/retrieve-key endpoint: email + password returns API key
  • New POST /auth/request-key-regeneration + GET /auth/confirm-key-regeneration for key rotation
  • New CLI commands: nemar auth retrieve-key and nemar auth regenerate-key
  • Updated approval email to instruct users to retrieve key via CLI
  • Updated admin approve messaging to reflect the new secure flow

Test plan

  • Sign up a new user and verify approval email no longer contains API key
  • Run nemar auth retrieve-key with correct email/password and verify key is returned
  • Run nemar auth retrieve-key again and verify 409 (key already issued)
  • Run nemar auth regenerate-key and verify verification email is sent
  • Click the regeneration link and verify new key is shown, old key revoked
  • Login with old key fails, login with new key succeeds

Closes #140

- Stop sending API keys via email (security risk)
- Add POST /auth/retrieve-key: email + password -> API key
- Add POST /auth/request-key-regeneration: sends verification email
- Add GET /auth/confirm-key-regeneration: revokes old key, issues new
- Add 'nemar auth retrieve-key' CLI command
- Add 'nemar auth regenerate-key' CLI command
- Update approval email to instruct CLI key retrieval
- Update admin approve messaging to reflect new flow

Closes #140
@github-actions

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR143

Version: 0.5.0-PR143.4e89d06
Commit: 4e89d06


🤖 Updated on each push.

- Add new auth endpoints to strict rate limit paths
- Apply escapeHtml to all user data in HTML templates
- Escape username, URLs, and user descriptions
@neuromechanist
neuromechanist merged commit 9d18b28 into dev Feb 13, 2026
2 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-140-secure-auth-flow branch March 6, 2026 23:56

This branch was previously deployed

1 inactive deployment
npm — 7ec3e6cc Deployed Feb 13, 2026 by neuromechanist via publish #248
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant