Commit graph

2 commits

Author SHA1 Message Date
PeterChrz
a3dd7fca24
fix(channels/buzz): drive NIP-42 handshake from relay rejection
Calling relay.Auth() immediately after RelayConnect signed an auth event
with an empty challenge tag. go-nostr keeps the relay's challenge on an
unexported field populated by its reader goroutine when the AUTH envelope
arrives, so the value is not yet set at connect time, and relays reject
the resulting event.

Subscribe first and run the handshake only once the relay answers
"auth-required". That guarantees the challenge has been read: the CLOSED
envelope is processed after AUTH on the relay's single reader goroutine,
and receiving it over a channel establishes the happens-before edge that
makes the read safe.

A second rejection after authenticating is a permissions failure rather
than a mistimed handshake, so it fails instead of retrying. Both waits
are bounded by a 15s timeout, and relays that accept without auth still
work via EndOfStoredEvents.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-11 22:06:34 -04:00
PeterChrz
9b4df86182
feat(channels): add Buzz (Nostr relay) channel
Implements a Buzz channel backed by a Nostr relay:
- kind:9 events scoped by "h" tag, "p" tags for mentions
- NIP-42 (kind:22242) auth before subscription
- optional threaded replies via "e" tag
- registered as config.ChannelBuzz with BuzzSettings
2026-08-11 21:41:16 -04:00