Structured files/directories and nip01, nip02, nip17 implementation

This commit is contained in:
Malte Schröder
2025-12-07 17:50:25 +01:00
commit b651c13fed
14 changed files with 1965 additions and 0 deletions

23
src/nips/nip02.rs Normal file
View File

@@ -0,0 +1,23 @@
use anyhow::Result;
use nostr_sdk::prelude::*;
use std::time::Duration;
/// Ruft das letzte Kontaktlisten-Event (Kind 3) für den Benutzer ab.
pub async fn get_contact_list_event(client: &Client) -> Result<Option<Event>> {
let signer = client.signer().await?;
// FIX: Die Methode heißt jetzt get_public_key()
let public_key = signer.get_public_key().await?;
let filter = Filter::new()
.author(public_key)
.kind(Kind::ContactList)
.limit(1);
let timeout = Duration::from_secs(10);
// fetch_events nimmt einen einzelnen Filter
let events = client.fetch_events(filter, timeout).await?;
Ok(events.into_iter().next())
}