keyutil

package
v1.22.61 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 24, 2025 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package keyutil provides utilities for loading private keys that integrate with the Lux CLI key management system (~/.lux/keys/).

Index

Constants

View Source
const (
	// LuxKeysDir is the CLI key storage directory
	LuxKeysDir = ".lux/keys"
	// MnemonicFile is the mnemonic filename used by CLI
	MnemonicFile = "mnemonic.txt"
	// ECPrivateKeyFile is the EC private key filename used by CLI
	ECPrivateKeyFile = "ec/private.key"
)

Variables

This section is empty.

Functions

func LoadKey

func LoadKey() (*secp256k1.PrivateKey, error)

LoadKey attempts to load a private key using the priority order above.

func LoadKeyByName

func LoadKeyByName(name string) (*secp256k1.PrivateKey, error)

LoadKeyByName loads a key from ~/.lux/keys/<name>/ It first tries the EC private key file, then falls back to mnemonic

func MustLoadKey

func MustLoadKey() *secp256k1.PrivateKey

MustLoadKey loads a secp256k1 private key from (in order of priority): 1. LUX_MNEMONIC environment variable (BIP39 mnemonic phrase) 2. LUX_PRIVATE_KEY environment variable (hex-encoded) 3. LUX_KEY_NAME environment variable (key name from ~/.lux/keys/<name>/) 4. Key name provided as first command line argument 5. ~/.lux/keys/default/ if it exists

Panics with a helpful message if no key is provided.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL