keyutil

package
v1.28.6 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: BSD-3-Clause Imports: 11 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. MNEMONIC environment variable (BIP-39 mnemonic phrase)
  2. Liquid KMS via native ZAP — when KMS_ADDR + KMS_ENV + KMS_MNEMONIC_PATH are set in the environment. Uses the canonical luxfi/kms keys.LoadMnemonic loader so every Lux-derived service resolves keys the same way.
  3. Key name provided as first command-line argument
  4. ~/.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