View Source Nostr.Client (Nostr v0.1.3)

Connects to a relay through websockets

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Get encrypted direct messages from a private key

Follow a new contact using either a binary public key or a npub

Reposts a note

Sends a note to the relay

Starts the client

Get an author's contacts

Get an author's deletions

Get a note by id

Get an author's notes

Get an author's profile

Get an author's reactions

Get an author's reposts

Get an author's realtime timeline including notes from everyone the author follows

Unfollow from a contact

Update the profile that's linked to the private key

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

delete_events(note_ids, note, privkey)

View Source

Deletes events

Link to this function

encrypted_direct_messages(private_key)

View Source
@spec encrypted_direct_messages(<<_::256>>) :: DynamicSupervisor.on_start_child()

Get encrypted direct messages from a private key

@spec follow(Nostr.Models.Profile.t(), K256.Schnorr.signing_key()) ::
  GenServer.on_start()
@spec follow(<<_::256>> | String.t(), <<_::256>> | String.t()) ::
  {:ok, GenServer.on_start()} | {:error, binary()}

Follow a new contact using either a binary public key or a npub

Link to this function

react(note_id, privkey, content \\ "+")

View Source
Link to this function

repost(note_id, privkey)

View Source
@spec repost(<<_::256>> | String.t(), <<_::256>> | String.t()) :: GenServer.on_start()

Reposts a note

Link to this function

send_encrypted_direct_messages(remote_pubkey, message, private_key)

View Source
@spec send_encrypted_direct_messages(
  K256.Schnorr.verifying_key() | <<_::256>>,
  String.t(),
  K256.Schnorr.signing_key() | <<_::256>>
) :: {:ok, :ok} | {:error, binary() | atom()}

Sends an encrypted direct message

Link to this function

send_note(note, privkey)

View Source
@spec send_note(String.t(), K256.Schnorr.signing_key()) ::
  :ok | {:error, binary() | atom()}

Sends a note to the relay

Link to this function

start_link(config \\ {})

View Source
@spec start_link(tuple()) :: Supervisor.on_start()

Starts the client

examples

Examples

iex> Nostr.Client.start_link("wss://relay.nostr.pro")

Link to this function

subscribe_contacts(pubkey)

View Source
@spec subscribe_contacts(<<_::256>>) :: DynamicSupervisor.on_start_child()

Get an author's contacts

Link to this function

subscribe_deletions(pubkeys)

View Source
@spec subscribe_deletions(list()) :: DynamicSupervisor.on_start_child()

Get an author's deletions

@spec subscribe_note(<<_::256>>) :: DynamicSupervisor.on_start_child()

Get a note by id

Link to this function

subscribe_notes(pubkeys)

View Source
@spec subscribe_notes([<<_::256>>]) :: DynamicSupervisor.on_start_child()

Get an author's notes

Link to this function

subscribe_profile(pubkey)

View Source
@spec subscribe_profile(K256.Schnorr.verifying_key() | binary()) ::
  {:ok, DynamicSupervisor.on_start_child()} | {:error, String.t()}

Get an author's profile

Link to this function

subscribe_reactions(pubkeys)

View Source
@spec subscribe_reactions([<<_::256>>]) :: DynamicSupervisor.on_start_child()

Get an author's reactions

Link to this function

subscribe_reposts(pubkeys)

View Source
@spec subscribe_reposts(list()) :: DynamicSupervisor.on_start_child()

Get an author's reposts

Link to this function

subscribe_timeline(pubkey)

View Source
@spec subscribe_timeline(<<_::256>>) :: DynamicSupervisor.on_start_child()

Get an author's realtime timeline including notes from everyone the author follows

Link to this function

unfollow(pubkey, privkey)

View Source
@spec unfollow(<<_::256>> | String.t(), <<_::256>> | String.t()) ::
  {:ok, GenServer.on_start()} | {:error, binary()}

Unfollow from a contact

Link to this function

update_profile(profile, privkey)

View Source

Update the profile that's linked to the private key