View Source Nostr.Tag (Nostr Lib v0.1.1)

Nostr Event tag

Summary

Functions

Parse JSON list into Elixir struct

Types

@type t() :: %Nostr.Tag{data: binary(), info: [binary()], type: atom()}

Functions

Link to this function

create(type, data, other_data \\ [])

View Source
@spec create(type :: atom() | binary(), data :: binary(), other_data :: [binary()]) ::
  t()

Create new Nostr tag

Each tag needs to have type and at least one data field. If tag requires more then one data field supply them as third argument (list of strings)

Example:

iex> Nostr.Tag.create(:e, "event-id", ["wss://relay.example.com"])
%Nostr.Tag{type: :e, data: "event-id", info: ["wss://relay.example.com"]}

iex> Nostr.Tag.create(:p, "pubkey")
%Nostr.Tag{type: :p, data: "pubkey", info: []}
@spec parse(tag :: nonempty_maybe_improper_list()) :: t()

Parse JSON list into Elixir struct