View Source NostrBasics.Models.Profile (NostrBasics v0.1.4)

Represents a user's profile

Link to this section Summary

Functions

Creates a new nostr profile

Link to this section Types

@type t() :: %NostrBasics.Models.Profile{
  about: term(),
  banner: term(),
  display_name: term(),
  lud16: term(),
  name: term(),
  nip05: term(),
  picture: term(),
  website: term()
}

Link to this section Functions

Link to this function

to_event(profile, pubkey)

View Source
@spec to_event(t(), NostrBasics.Keys.PublicKey.id()) ::
  {:ok, NostrBasics.Event.t()} | {:error, String.t()}

Creates a new nostr profile

examples

Examples

iex> %NostrBasics.Models.Profile{
...>   about: "some user description",
...>   banner: "https://image.com/satoshi_banner",
...>   display_name: "satoshi nakamoto",
...>   lud16: "satoshi@nakamoto.jp",
...>   name: "satoshi nakamoto",
...>   nip05: "_@nakamoto.jp",
...>   picture: "https://image.com/satoshi_avatar",
...>   website: "https://bitcoin.org"
...> }
...> |> NostrBasics.Models.Profile.to_event(<<0x5ab9f2efb1fda6bc32696f6f3fd715e156346175b93b6382099d23627693c3f2::256>>)
{
  :ok,
  %NostrBasics.Event{
    pubkey: <<0x5ab9f2efb1fda6bc32696f6f3fd715e156346175b93b6382099d23627693c3f2::256>>,
    kind: 0,
    tags: [],
    content: ~s({"about":"some user description","banner":"https://image.com/satoshi_banner","display_name":"satoshi nakamoto","lud16":"satoshi@nakamoto.jp","name":"satoshi nakamoto","nip05":"_@nakamoto.jp","picture":"https://image.com/satoshi_avatar","website":"https://bitcoin.org"})
  }
}