From cbc8217856b8ba989c9950876a1a6402001537d1 Mon Sep 17 00:00:00 2001 From: Andrea Diaz Correia Date: Sun, 5 Oct 2025 19:59:48 -0300 Subject: [PATCH] feat: improve error logging for gift wrap decryption and use admin pubkey for DM filtering --- src/parser/dms.rs | 8 ++++---- src/util.rs | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/parser/dms.rs b/src/parser/dms.rs index f4a1466..2129b28 100644 --- a/src/parser/dms.rs +++ b/src/parser/dms.rs @@ -25,16 +25,16 @@ pub async fn parse_dm_events(events: Events, pubkey: &Keys) -> Vec<(Message, u64 nostr_sdk::Kind::GiftWrap => { let unwrapped_gift = match nip59::extract_rumor(pubkey, dm).await { Ok(u) => u, - Err(_) => { - println!("Error unwrapping gift"); + Err(e) => { + eprintln!("Warning: Could not decrypt gift wrap (event {}): {}", dm.id, e); continue; } }; let (message, _): (Message, Option) = match serde_json::from_str(&unwrapped_gift.rumor.content) { Ok(msg) => msg, - Err(_) => { - println!("Error parsing gift wrap content"); + Err(e) => { + eprintln!("Warning: Could not parse message content (event {}): {}", dm.id, e); continue; } }; diff --git a/src/util.rs b/src/util.rs index 1f4fe50..a65f95a 100644 --- a/src/util.rs +++ b/src/util.rs @@ -567,7 +567,8 @@ pub async fn fetch_events_list( Ok(orders.into_iter().map(Event::SmallOrder).collect()) } ListKind::DirectMessagesAdmin => { - let filters = create_filter(list_kind, ctx.mostro_pubkey, None)?; + // Fetch gift wraps sent TO the admin's public key (not Mostro's) + let filters = create_filter(list_kind, ctx.context_keys.public_key(), None)?; let fetched_events = ctx .client .fetch_events(filters, FETCH_EVENTS_TIMEOUT)