NostrElixir.Keys (nostr_elixir v0.1.0)
View SourceKey management functions for NostrElixir.
Examples
iex> alias NostrElixir.Keys
iex> keys = Keys.generate_keypair()
iex> Keys.public_key_to_bech32(keys.public_key)
"npub..."
Summary
Functions
Generate a new keypair and return it in a convenient map format.
Generate a new keypair (JSON string).
Extract public key from keys JSON.
Extract secret key from keys JSON.
Parse a secret key and return it in a convenient map format.
Parse a secret key (hex or bech32) to JSON string.
Convert hex public key to bech32 npub.
Convert hex secret key to bech32 nsec.
Convert bech32 secret key to hex.
Types
Functions
@spec generate_keypair() :: keys_map()
Generate a new keypair and return it in a convenient map format.
@spec generate_keys() :: String.t()
Generate a new keypair (JSON string).
Extract public key from keys JSON.
Extract secret key from keys JSON.
@spec parse_keypair(hex_key() | bech32_key()) :: keys_map()
Parse a secret key and return it in a convenient map format.
@spec parse_keys(hex_key() | bech32_key()) :: String.t()
Parse a secret key (hex or bech32) to JSON string.
@spec public_key_to_bech32(hex_key()) :: bech32_key()
Convert hex public key to bech32 npub.
@spec secret_key_to_bech32(hex_key()) :: bech32_key()
Convert hex secret key to bech32 nsec.
@spec secret_key_to_hex(bech32_key()) :: hex_key()
Convert bech32 secret key to hex.