NIP-01
The Event struct represents the structure for an event in Nostr. Many of the NIPs define specific content
and tags
that are required to correctly represent a kind. The nostr
crate ships with a set of NIP-specific utilities for working with certain event kinds.
Metadata (NIP-01)
Rust
Use the Metadata
struct to deserialize the content of an event into a struct.
let event = EventBuilder::new(Kind::Metadata, content, vec![]).to_event(&keys)?;
let metadata = Metadata::from_json(&event.content)?;
If you have an existing metadata object, it can be used with the EventBuilder struct to create an EventBuilder
with the metadata already attached.
let metadata = Metadata::from_json(content)?;
let event = EventBuilder::metadata(&metadata).to_event(&keys)?;
For documentation on the available struct attributes, check out the Metadata documentation.
Python
TODO
JavaScript
TODO
Kotlin
TODO
Swift
TODO