keysv2

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateInterfaceRegistryWithEVMSupport

func CreateInterfaceRegistryWithEVMSupport() codectypes.InterfaceRegistry

CreateInterfaceRegistryWithEVMSupport creates an interface registry with EVM-compatible key types

func CreateKeyring

func CreateKeyring(homeDir string, reader io.Reader, keyringBackend KeyringBackend) (keyring.Keyring, error)

CreateKeyring creates a keyring with EVM compatibility

func CreateKeyringFromConfig

func CreateKeyringFromConfig(homeDir string, reader io.Reader, configBackend config.KeyringBackend) (keyring.Keyring, error)

CreateKeyringFromConfig creates a keyring with EVM compatibility from config backend type

func CreateNewKey

func CreateNewKey(kr keyring.Keyring, name string, mnemonic string, passphrase string) (*keyring.Record, string, error)

CreateNewKey creates a new key in the keyring and returns the record and mnemonic. If mnemonic is provided, it imports the key; otherwise, it generates a new one. The returned mnemonic will be empty if importing from an existing mnemonic.

func GetKeyringKeybase

func GetKeyringKeybase(cfg KeyringConfig) (keyring.Keyring, string, error)

GetKeyringKeybase creates and returns keyring and key info

func ValidateKeyExists

func ValidateKeyExists(kr keyring.Keyring, keyName string) error

ValidateKeyExists checks if a key exists in the keyring

Types

type KeyringBackend

type KeyringBackend string

KeyringBackend represents the type of keyring backend to use

const (
	// KeyringBackendTest is the test Cosmos keyring backend (unencrypted)
	KeyringBackendTest KeyringBackend = "test"

	// KeyringBackendFile is the file Cosmos keyring backend (encrypted)
	KeyringBackendFile KeyringBackend = "file"
)

type KeyringConfig

type KeyringConfig struct {
	HomeDir        string
	KeyringBackend KeyringBackend
	HotkeyName     string
	HotkeyPassword string
}

KeyringConfig holds configuration for keyring initialization

type Keys

type Keys struct {
	// contains filtered or unexported fields
}

Keys manages all the keys used by Universal Validator

func NewKeys

func NewKeys(
	kr keyring.Keyring,
	keyName string,
	hotkeyPassword string,
) *Keys

NewKeys creates a new instance of Keys

func (*Keys) GetAddress

func (k *Keys) GetAddress() (sdk.AccAddress, error)

GetAddress returns the hot key address

func (*Keys) GetKeyName

func (k *Keys) GetKeyName() string

GetKeyName returns the name of the hot key in the keyring

func (*Keys) GetKeyring

func (k *Keys) GetKeyring() (keyring.Keyring, error)

GetKeyring returns the underlying keyring for signing operations. It validates that the key exists in the keyring before returning it. For file backend, the keyring handles decryption automatically when signing.

type UniversalValidatorKeys

type UniversalValidatorKeys interface {
	// GetAddress returns the hot key address
	GetAddress() (sdk.AccAddress, error)

	// GetKeyName returns the name of the hot key in the keyring
	GetKeyName() string

	// GetKeyring returns the underlying keyring for signing operations.
	// It validates that the key exists before returning the keyring.
	// For file backend, decryption happens automatically when signing via tx.Sign().
	// This allows signing without exposing the private key.
	GetKeyring() (keyring.Keyring, error)
}

UniversalValidatorKeys defines the interface for key management in Universal Validator

Jump to

Keyboard shortcuts

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