Nostr.Event.HttpAuth (Nostr Lib v0.2.1) (event) (nip98)

View Source

HTTP authentication events (kind 27235).

Implements NIP-98: https://github.com/nostr-protocol/nips/blob/master/98.md

Required tags:

  • u - absolute request URL
  • method - HTTP method

Optional tags:

  • payload - request payload SHA256 hash (hex)

Summary

Functions

Creates a new HTTP auth event.

Parses a kind 27235 event into an HttpAuth struct.

Types

t()

@type t() :: %Nostr.Event.HttpAuth{
  event: Nostr.Event.t(),
  method: String.t() | nil,
  payload: String.t() | nil,
  url: String.t() | nil
}

Functions

create(url, method, opts \\ [])

@spec create(String.t(), String.t(), Keyword.t()) :: t()

Creates a new HTTP auth event.

Options

  • :payload - raw request body to hash into a payload tag
  • :payload_hash - precomputed SHA256 hex for the payload tag
  • :pubkey - event pubkey (optional)
  • :created_at - event timestamp (optional)
  • :tags - additional tags to append (optional)
  • :content - event content (defaults to empty string)

parse(event)

@spec parse(Nostr.Event.t()) :: t() | {:error, String.t(), Nostr.Event.t()}

Parses a kind 27235 event into an HttpAuth struct.