Nostr. Event. Unknown
(Nostr Lib v0.2.1)
(event)
(nip31)
View Source
Unknown event kind wrapper (NIP-31)
Wraps events of unknown kinds and extracts the alt tag if present,
providing a human-readable description for clients that don't understand
the event kind.
Usage
When creating custom event kinds that aren't meant to be read as text,
include an alt tag with a short human-readable plaintext summary:
Unknown.create(30078, alt: "Application-specific data for MyApp", content: "...")See: https://github.com/nostr-protocol/nips/blob/master/31.md
Summary
Types
@type t() :: %Nostr.Event.Unknown{alt: String.t() | nil, event: Nostr.Event.t()}
Functions
@spec create(kind :: non_neg_integer(), opts :: Keyword.t()) :: t()
Create a new event with an alt tag.
Options
:alt- human-readable description (required for NIP-31 compliance):pubkey- author pubkey:created_at- timestamp:tags- additional tags:content- event content
Examples
Unknown.create(30078, alt: "Application data event", content: "...")
Unknown.create(30078,
alt: "Custom protocol message",
content: "...",
tags: [Tag.create(:d, "identifier")]
)
@spec parse(Nostr.Event.t()) :: t()
Parse an event to extract the alt tag.