Nostr. Event. ClientAuth
(Nostr Lib v0.2.1)
(event)
(nip42)
View Source
Client authentication
Defined in NIP 42 https://github.com/nostr-protocol/nips/blob/master/42.md
Summary
Functions
Create a new ClientAuth event for authentication.
Parses a kind 22242 event into a ClientAuth struct with relay and challenge.
Types
@type t() :: %Nostr.Event.ClientAuth{ challenge: String.t(), event: Nostr.Event.t(), relay: URI.t() }
Functions
Create a new ClientAuth event for authentication.
Arguments:
relay- the relay URL to authenticate withchallenge- the challenge string received from the relayopts- other optional event arguments (pubkey,created_at,tags)
Example:
iex> auth = Nostr.Event.ClientAuth.create("wss://relay.example.com", "challenge123")
iex> auth.relay
"wss://relay.example.com"
iex> auth.challenge
"challenge123"
iex> auth.event.kind
22242
@spec parse(event :: Nostr.Event.t()) :: t()
Parses a kind 22242 event into a ClientAuth struct with relay and challenge.