diff options
| author | bndw <ben@bdw.to> | 2026-02-15 10:06:18 -0800 |
|---|---|---|
| committer | bndw <ben@bdw.to> | 2026-02-15 10:06:18 -0800 |
| commit | d744c32f1bc7411e04c97a9d14c172baaa0e4a89 (patch) | |
| tree | e9758c48d38798f2922ffbeaccd5f6105821a83a /internal/handler/websocket/handler.go | |
| parent | 8ae69fde76945377189281182954c946ff9ad419 (diff) | |
test: add integration tests for NIP-42 AUTH and rate limiting
Add comprehensive WebSocket handler integration tests that verify:
- NIP-42 authentication flow (auth required, challenge/response)
- Allowlist enforcement (reject unauthorized pubkeys)
- Rate limiting by IP address
- Rate limiting by authenticated pubkey
- No-auth mode works correctly
These tests use real WebSocket connections and would have caught
the AUTH timeout bug and other protocol issues.
Tests cover:
- TestAuthRequired: Verifies AUTH challenge sent, client authenticates, publish succeeds
- TestAuthNotInAllowlist: Verifies pubkeys not in allowlist are rejected
- TestRateLimitByIP: Verifies unauthenticated clients are rate limited by IP
- TestRateLimitByPubkey: Verifies authenticated clients are rate limited by pubkey
- TestNoAuthWhenDisabled: Verifies publishing works when auth is disabled
Diffstat (limited to 'internal/handler/websocket/handler.go')
0 files changed, 0 insertions, 0 deletions
