summaryrefslogtreecommitdiffstats
path: root/internal/storage
diff options
context:
space:
mode:
authorbndw <ben@bdw.to>2026-02-14 14:54:30 -0800
committerbndw <ben@bdw.to>2026-02-14 14:54:30 -0800
commit4dbd96ec697196d43ad41eca4fd43d53da46a081 (patch)
treefe3cf316855c4760d48a1a2f3cb4500aa9d3a681 /internal/storage
parent9ee32a917b13ffb3f52ddbc3a0c72dd8ec71953c (diff)
refactor: use AuthStore interface and remove type assertions
Replace runtime type assertions with compile-time safe AuthStore interface. Add connState struct for cleaner per-connection state management instead of mutable pointer parameters. Reduce auth challenge TTL from 10min to 2min. - Add AuthStore interface with CreateAuthChallenge and ValidateAndConsumeChallenge - Add connState struct for authenticatedPubkey and authChallenge - Remove fragile type assertion pattern in requireAuth and handleAuth - Add nil checks for auth store with clear error messages - Update Handler to have separate auth field - Wire auth store in main.go when auth is enabled
Diffstat (limited to 'internal/storage')
-rw-r--r--internal/storage/auth.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/storage/auth.go b/internal/storage/auth.go
index 6eefa41..e17ffeb 100644
--- a/internal/storage/auth.go
+++ b/internal/storage/auth.go
@@ -10,7 +10,7 @@ import (
10 10
11const ( 11const (
12 ChallengeLength = 32 // bytes 12 ChallengeLength = 32 // bytes
13 ChallengeTTL = 10 * time.Minute 13 ChallengeTTL = 2 * time.Minute
14) 14)
15 15
16func generateChallenge() (string, error) { 16func generateChallenge() (string, error) {