Skip to content

Add API Key Authentication Middleware for Gateway #19

@greatest0fallt1me

Description

@greatest0fallt1me

Description
Add middleware that resolves API key from header (e.g. Authorization: Bearer or X-Api-Key: ), looks up key by prefix, verifies full key hash, loads user and vault and API/endpoint. Attach to request: user, vault, api, endpoint, apiKeyRecord. Return 401 if invalid or revoked.

Requirements and context

  • Must be used by gateway routes that proxy to upstream APIs
  • Rate limit and balance check can be separate middleware

Suggested execution

  • Fork the repo and create a branch
  • git checkout -b feature/api-key-auth-middleware
  • Implement changes
    • Middleware: extract key, find by prefix, verify hash, load user/vault/api/endpoint
    • Return 401 with clear message if not found or revoked
    • Add unit tests for middleware
  • Test and commit
    • Run tests
    • Example commit message: feat: API key auth middleware for gateway

Guidelines

  • Constant-time key comparison where applicable
  • Clear documentation
  • Timeframe: 96 hours
  • Project details: #

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions