NostrElixir.Nip19 (nostr_elixir v0.1.0)

View Source

NIP-19 encoding and decoding functions for NostrElixir.

Examples

iex> alias NostrElixir.Nip19
iex> npub = Nip19.encode("npub", "eec7...619")
iex> Nip19.decode_map(npub)
%{data_type: "npub", data: _}

Summary

Functions

Decode bech32 format to JSON string.

Decode NIP-19 bech32 format and return as a map.

Encode data to bech32 format (npub, nsec, note).

Types

bech32()

@type bech32() :: String.t()

hex()

@type hex() :: String.t()

nip19_result()

@type nip19_result() :: %{data_type: String.t(), data: String.t()}

Functions

decode(bech32_string)

@spec decode(bech32()) :: String.t()

Decode bech32 format to JSON string.

decode_map(bech32_string)

@spec decode_map(bech32()) :: nip19_result()

Decode NIP-19 bech32 format and return as a map.

encode(type, data)

@spec encode(String.t(), String.t()) :: bech32()

Encode data to bech32 format (npub, nsec, note).

nip19_decode_nif(bech32_string)

See NostrElixir.nip19_decode_nif/1.

nip19_encode_nif(type, data)

See NostrElixir.nip19_encode_nif/2.