NostrElixir.Nip06 (nostr_elixir v0.1.0)

View Source

NIP-06: HD Wallet Derivation for Nostr

This module provides functions for deriving keys from BIP-39 mnemonics and seeds as specified in NIP-06. For mnemonic generation, validation, and seed conversion, use NostrElixir.Mnemonic.

Examples

iex> mnemonic = NostrElixir.Mnemonic.generate(12)
iex> seed = NostrElixir.Mnemonic.to_seed(mnemonic)
iex> NostrElixir.Nip06.derive_key(Base.encode16(seed, case: :lower), "m/44'/1237'/0'/0/0")
%{"public_key" => _pub, "secret_key" => _sec, "derivation_path" => "m/44'/1237'/0'/0/0"}

Summary

Functions

Derives a key from a seed (hex string) and derivation path.

Functions

derive_key(seed_hex, derivation_path)

Derives a key from a seed (hex string) and derivation path.

Parameters

  • seed_hex - The seed as a hex string (use Base.encode16(seed, case: :lower))
  • derivation_path - The BIP-32/44 derivation path (e.g., "m/44'/1237'/0'/0/0")

Returns

  • %{"public_key" => pub, "secret_key" => sec, "derivation_path" => path}