buzz icon indicating copy to clipboard operation
buzz copied to clipboard

[Bug] Mentions should use NIP-27

Open alexgleason opened this issue 4 months ago • 2 comments

Currently mentions are not interoperable with other Nostr clients. It's fine to type @username in the text box, but after hitting submit the event it generates should include a NIP-27 Nostr URI.

It's not just a compatibility issue. People on Nostr can change their username. This would break existing mentions. Plus there's not really any concept of a "username". The name can contain spaces. The correct solution is NIP-27.

alexgleason avatar Jul 22 '26 01:07 alexgleason

Fixed in https://github.com/block/buzz/pull/2503 — composer keeps @name; wire events get nostr:npub1….

chessing234 avatar Jul 23 '26 11:07 chessing234

There's a focused alternative open for this issue: https://github.com/block/buzz/pull/4398

#2503 does implement outbound @name → nostr:npub1… rewrite and a basic display map-back, but I think #4398 is the stronger candidate to merge for #2319 specifically:

  1. Scoped to the issue. #2503 bundles NIP-27 with unrelated community-create handoff and workflow #h filter changes. That makes review, bisect, and rollback harder, and keeps the mention fix gated on unrelated work. #4398 only changes the mention encode/display path.

  2. Inbound nprofile + body-only hydration. #2503's display path mainly maps known nostr:npub1… URIs back through already-available tag-derived name maps. #4398 also:

    • decodes nostr:nprofile1… (relay-hinted profile refs)
    • extracts profile pubkeys from prose even when no p/mention tag is present
    • batch-hydrates those profiles and renders the same mention chips with current display names

    That matches the issue's interoperability goal: foreign clients often ship NIP-27 body refs without Buzz's local tag conventions.

  3. Stronger prose safety. #4398 protects code spans/blocks, Markdown link destinations, email-like tokens, escaped \@, existing nostr: URIs, and non-profile NIP-21 entities; applies longest-name-wins on overlap; and is idempotent under re-encode. #2503 leans mainly on existing code masking via getMentionOffset.

  4. Current main. #4398 is rebased on latest main with a single signed/DCO commit. #2503 still mixes three concerns and is currently merge-blocked.

Happy to adjust #4398 if maintainers prefer splitting further or aligning naming with the helpers in #2503 — but for closing #2319 cleanly, the focused full encode+display path in #4398 looks like the better merge target.

fresh3nough avatar Aug 02 '26 19:08 fresh3nough