Skip to content

Write unit tests for auth middleware and challenge/verify flow #335

@ogazboiz

Description

@ogazboiz

Join our community: https://t.me/+DOylgFv1jyJlNzM0

Description

The auth middleware and challenge/verify endpoints were added but have no tests. Authentication bugs could silently expose all stream data or lock out legitimate users.

Test Cases Needed

  • test_challenge_returns_nonce_for_valid_address
  • test_verify_valid_signature_returns_jwt
  • test_verify_expired_nonce_returns_401
  • test_verify_invalid_signature_returns_401
  • test_auth_middleware_accepts_valid_jwt
  • test_auth_middleware_rejects_expired_jwt
  • test_auth_middleware_rejects_missing_token
  • test_sse_endpoint_requires_auth

Files

  • backend/src/__tests__/auth.test.ts (create)

Acceptance Criteria

  • All 8 tests pass
  • Mock signature verification (no real Stellar RPC)
  • Runs in CI

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbackendBackend related taskstestingTesting related tasks

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions