upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-08-19 09:18:10 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2025-08-19 09:18:10 +0100
commit94e8af2b27169c0b05e512cec91147f4ae25fa9d (patch)
tree37d63d099048b5607535ead8e908818ac78d40f0
parentb7d4c5a81f0a008524dcc5b4f286f0cf700013c0 (diff)
fix: nip05 without local part
allow users to use just a nip05 domain in nostr:// urls rather than requiring _@ prefix.
-rw-r--r--src/lib/client.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/client.rs b/src/lib/client.rs
index 92bf266..b8d2856 100644
--- a/src/lib/client.rs
+++ b/src/lib/client.rs
@@ -888,6 +888,13 @@ pub async fn fetch_public_key(signer: &Arc<dyn NostrSigner>) -> Result<nostr::Pu
888} 888}
889 889
890pub async fn nip05_query(nip05_addr: &str) -> Result<Nip05Profile> { 890pub async fn nip05_query(nip05_addr: &str) -> Result<Nip05Profile> {
891 // can be removed if this rust-nostr patch is merged
892 // nostr:nevent1qvzqqqqx2ypzpgqgmmc409hm4xsdd74sf68a2uyf9pwel4g9mfdg8l5244t6x4jdqqsv0xw23ejw77lfvlaqv5y5nnvdc0p68kmvp2vnklpe9wxx0lkugdcv4zjgk
893 let nip05_addr = if nip05_addr.contains('@') {
894 nip05_addr
895 } else {
896 &format!("_@{nip05_addr}")
897 };
891 let addr_deconstructed = Nip05Address::parse(nip05_addr) 898 let addr_deconstructed = Nip05Address::parse(nip05_addr)
892 .context(format!("cannot parse nip05 address: {nip05_addr}"))?; 899 .context(format!("cannot parse nip05 address: {nip05_addr}"))?;
893 let json_res: Value = reqwest::Client::new() 900 let json_res: Value = reqwest::Client::new()