notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit 2a74b75bd61cc47e4c870d38356a0f34df49d551
parent baa1655c55ce7fc635638a3aa9279bda1d260d3c
Author: William Casarin <jb55@jb55.com>
Date:   Wed, 18 Feb 2026 12:23:47 -0800

search: add nevent1 bech32 support

Allow pasting nevent1 bech32 strings into the search bar to navigate
to the referenced note, matching the existing note1 support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Diffstat:
Mcrates/enostr/src/note.rs | 7+++++++
Mcrates/notedeck_columns/src/ui/search/mod.rs | 6+++++-
2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/crates/enostr/src/note.rs b/crates/enostr/src/note.rs @@ -46,6 +46,13 @@ impl NoteId { Some(NoteId::new(data.try_into().ok()?)) } + + /// Parse a NIP-19 nevent1 bech32 string and extract the event ID. + pub fn from_nevent_bech(bech: &str) -> Option<Self> { + use nostr::nips::nip19::{FromBech32, Nip19Event}; + let nip19_event = Nip19Event::from_bech32(bech).ok()?; + Some(NoteId::new(nip19_event.event_id.to_bytes())) + } } /// Event is the struct used to represent a Nostr event diff --git a/crates/notedeck_columns/src/ui/search/mod.rs b/crates/notedeck_columns/src/ui/search/mod.rs @@ -600,7 +600,11 @@ pub enum SearchType { impl SearchType { fn get_type(query: &str) -> Self { - if query.len() == 63 && query.starts_with("note1") { + if query.starts_with("nevent1") { + if let Some(noteid) = NoteId::from_nevent_bech(query) { + return SearchType::NoteId(noteid); + } + } else if query.len() == 63 && query.starts_with("note1") { if let Some(noteid) = NoteId::from_bech(query) { return SearchType::NoteId(noteid); }