Documentation
¶
Overview ¶
Package keys provides key derivation and management utilities for LUX.
Index ¶
- Constants
- func DeriveKeyFromMnemonic(mnemonic string, accountIndex uint32) ([]byte, error)
- func DeriveKeyFromSeed(seed []byte, accountIndex uint32) ([]byte, error)
- func LoadKey(keyPath string) ([]byte, error)
- func LoadKeyFromEnv() ([]byte, error)
- func LoadKeyFromFile(path string) ([]byte, error)
- func MustNewKeychain(keyBytes []byte) *secp256k1fx.Keychain
- func NewKeychain(keyBytes []byte) (*secp256k1fx.Keychain, error)
- func ToPrivateKey(keyBytes []byte) (*secp256k1.PrivateKey, error)
Constants ¶
const ( // LUXCoinType is the BIP-44 coin type for LUX (9000') LUXCoinType = 9000 // DefaultDerivationPath is the standard BIP-44 path for LUX: m/44'/9000'/0'/0/0 DefaultDerivationPath = "m/44'/9000'/0'/0/0" )
Variables ¶
This section is empty.
Functions ¶
func DeriveKeyFromMnemonic ¶
DeriveKeyFromMnemonic derives a private key from a BIP-39 mnemonic using BIP-44 path. Default path: m/44'/9000'/0'/0/0
func DeriveKeyFromSeed ¶
DeriveKeyFromSeed derives a private key from a BIP-39 seed using BIP-44 path. Path: m/44'/9000'/0'/0/{accountIndex}
func LoadKey ¶
LoadKey loads a key from file, environment, or returns an error. Priority: 1) keyPath if non-empty, 2) LUX_PRIVATE_KEY env, 3) LUX_MNEMONIC env
func LoadKeyFromEnv ¶
LoadKeyFromEnv loads a key from environment variables. Priority: 1) LUX_PRIVATE_KEY (hex), 2) LUX_MNEMONIC (24 words)
func LoadKeyFromFile ¶
LoadKeyFromFile reads a hex-encoded private key from a file.
func MustNewKeychain ¶
func MustNewKeychain(keyBytes []byte) *secp256k1fx.Keychain
MustNewKeychain creates a secp256k1fx.Keychain from raw key bytes, panics on error.
func NewKeychain ¶
func NewKeychain(keyBytes []byte) (*secp256k1fx.Keychain, error)
NewKeychain creates a secp256k1fx.Keychain from raw key bytes.
func ToPrivateKey ¶
func ToPrivateKey(keyBytes []byte) (*secp256k1.PrivateKey, error)
ToPrivateKey converts raw key bytes to a secp256k1 private key.
Types ¶
This section is empty.