added metadata and test

This commit is contained in:
2026-01-31 16:27:12 +01:00
parent 1becf76264
commit 9845dd025d
6 changed files with 178 additions and 1 deletions

View File

@@ -13,6 +13,7 @@
* **Social Connectivity**: Follow users and manage contact lists.
* **Rich Feeds**: Access follow-based timelines, global discovery, and hashtag-based searches.
* **Encrypted Messaging**: Secure NIP-17 direct messages.
* **Profile Management**: Update account metadata (Kind 0) with support for standard and custom fields.
* **Extensible Architecture**: Clean separation between protocol logic (NIPs) and high-level functions.
---
@@ -67,6 +68,24 @@ let event_id = en.post_text("Building with EasyNostr is awesome!").await?;
println!("Successfully posted! Event ID: {}", event_id);
```
### 👤 Profile & Metadata
Update account information (NIP-01) including support for custom fields (e.g., bot, birthday).
```rust
en.set_metadata(
Some("user_name".to_string()),
Some("Display Name".to_string()),
Some("About me...".to_string()),
Some("user@domain.com".to_string()), // NIP-05
Some("user@getalby.com".to_string()), // LUD-16
Some("https://website.com".to_string()),
Some("https://banner.com/img.png".to_string()),
Some(false), // bot (custom field)
Some("1990-01-01".to_string()), // birthday (custom field)
).await?;
```
### 📰 Social Feeds
#### Timeline (Followed Users)