Skip to content

feat: Optional API Key Authentication Middleware (#198)#242

Merged
Sulex45 merged 1 commit into
stellarkit-lab-devtools:mainfrom
AnnabelJoe:feat/198-optional-api-key-auth
Jun 8, 2026
Merged

feat: Optional API Key Authentication Middleware (#198)#242
Sulex45 merged 1 commit into
stellarkit-lab-devtools:mainfrom
AnnabelJoe:feat/198-optional-api-key-auth

Conversation

@AnnabelJoe

Copy link
Copy Markdown
Contributor

Build an optional API key authentication middleware that can be switched on via environment variable, allowing deployments to restrict access to trusted clients only.

Changes:

  • Created src/middleware/apiKeyAuth.js
  • Integrated middleware in src/index.js
  • Ensures /health and / endpoints remain public
  • Returns 401 for missing/invalid keys when enabled
  • Added comprehensive unit tests

Closes #198

…ools#198)

Add middleware at src/middleware/apiKeyAuth.js that can be enabled via REQUIRE_API_KEY=true. Valid keys are configured via API_KEYS env var. Ensures /health endpoint remains public. Includes support for whitespace trimming in the X-API-Key header.
@drips-wave

drips-wave Bot commented Jun 7, 2026

Copy link
Copy Markdown

@AnnabelJoe Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Sulex45 Sulex45 merged commit d12b0e0 into stellarkit-lab-devtools:main Jun 8, 2026
1 of 3 checks passed
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.

Optional API Key Authentication Middleware

2 participants