crypto

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddressFromKey

func AddressFromKey(kr keyring.Keyring, keyName, hrp string) (string, error)

AddressFromKey derives an account address for the given HRP from the public key stored in the keyring under keyName, without mutating the global bech32 prefix configuration.

func GetKey

func GetKey(kr keyring.Keyring, keyName string) (*keyring.Record, error)

GetKey returns metadata for the named key in the provided keyring.

func ImportKeyFromMnemonic

func ImportKeyFromMnemonic(kr keyring.Keyring, keyName, mnemonicFile, hrp string) ([]byte, string, error)

ImportKeyFromMnemonic imports the mnemonic into an existing keyring (if needed), returning the pubkey bytes and address for the provided HRP.

func LoadKeyringFromMnemonic

func LoadKeyringFromMnemonic(keyName, mnemonicFile string) (keyring.Keyring, []byte, string, error)

LoadKeyringFromMnemonic creates a test keyring, imports the mnemonic, and returns the keyring, pubkey bytes, and Lumera address.

func NewDefaultTxConfig

func NewDefaultTxConfig() client.TxConfig

NewDefaultTxConfig constructs a client.TxConfig backed by a protobuf codec, registering Lumera action message interfaces as required for signing/encoding.

func NewKeyring

func NewKeyring(p KeyringParams) (keyring.Keyring, error)

NewKeyring creates a new Cosmos keyring with the provided parameters.

func SignTxWithKeyring

func SignTxWithKeyring(
	ctx context.Context,
	txCfg client.TxConfig,
	kr keyring.Keyring,
	keyName string,
	builder client.TxBuilder,
	chainID string,
	accountNumber uint64,
	sequence uint64,
	overwrite bool,
) error

SignTxWithKeyring signs the provided TxBuilder using the given keyring identity. The caller must supply chainID, account number and sequence. Set overwrite=false for the first signature; true for subsequent signers on the same tx.

Types

type KeyringParams

type KeyringParams struct {
	// AppName names the keyring namespace. Default: "lumera"
	AppName string
	// Backend selects the keyring backend ("os" | "file" | "test"). Default: "os"
	Backend string
	// Dir is the root directory for the keyring (if Backend="file"). Default: $HOME/.lumera
	Dir string
	// Input is an optional io.Reader for interactive backends (nil for non-interactive)
	Input io.Reader
}

KeyringParams holds configuration for initializing a Cosmos keyring.

func DefaultKeyringParams

func DefaultKeyringParams() KeyringParams

DefaultKeyringParams returns sensible defaults:

  • AppName: "lumera"
  • Backend: "os"
  • Dir: $HOME/.lumera

Jump to

Keyboard shortcuts

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