mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-09 16:14:40 +00:00
Introduce OptionalAuthPolicy, a relay-server policy that runs the full NIP-42 challenge/verify handshake — emitting the AUTH challenge on connect and recording verified pubkeys into the connection scope — but never requires it: EVENT, REQ, and COUNT are always accepted, so clients that ignore the challenge keep working. It subclasses FullAuthPolicy and only relaxes the EVENT/REQ/COUNT gates, so the authorize() hook and per-connection authenticatedUsers set behave identically; downstream policies can still gate or rewrite on caller identity. Wire it into geode via an optional_auth config option and a --optional-auth CLI flag (ignored when require_auth/--auth is set, since mandatory AUTH already sends the challenge). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BJWy4dBBYLbqthhLvbcZh7