fix: extract NIP-OA owner on open relays for observer frame auth#513
Merged
tlongwell-block merged 6 commits intoMay 8, 2026
Merged
Conversation
NIP-OA signatures are cryptographically self-proving — if verify_auth_tag passes, the owner relationship is authentic regardless of config flags. The allow_nip_oa_auth flag now only controls whether NIP-OA can grant membership access on closed relays, not whether the relay records agent→owner mappings from valid attestations.
b454e16 to
810528f
Compare
This was referenced May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On open Sprout relays (
require_relay_membership = false), managed agents cannot publish kind:24200 observer frames because the relay'shandle_agent_observer_event()requires anagent→ownermapping in the DB. This mapping is normally written during NIP-OA auth, but on open relays theenforce_relay_membership()function short-circuits withreturn Ok(None)before extracting the NIP-OA owner — so the mapping never gets written.Root Cause
In
crates/sprout-relay/src/api/mod.rs,enforce_relay_membership()returnsOk(None)immediately whenrequire_relay_membership = false, skipping NIP-OA owner extraction entirely. The auth handler then seesnip_oa_owner = Noneand skips the DB backfill.Fix
extract_nip_oa_ownerhelper — pure function that validates a NIP-OA auth tag and returns the owner pubkey (no side effects, no membership checks)extract_nip_oa_ownerdirectly when the membership gate returnsNone, enabling the existing DB backfill pathenforce_relay_membershipunchanged — stays a pure gate function for all other callers (HTTP, media, git, audio)Design Decisions
!state.config.require_relay_membership && state.config.allow_nip_oa_authFiles Changed
crates/sprout-relay/src/api/mod.rs—extract_nip_oa_ownerhelper + tests + doc updatecrates/sprout-relay/src/handlers/auth.rs— open-relay NIP-OA backfill callcrates/sprout-relay/src/config.rs—allow_nip_oa_authdoc comment updateTesting
cargo clippycleancargo fmtclean