keyring

package
v2.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: Apache-2.0 Imports: 4 Imported by: 73

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KeyringContextKey struct{}

KeyringContextKey is the key used to store the keyring in the context. The keyring must be wrapped using the KeyringImpl.

Functions

func NewKeyringInContext

func NewKeyringInContext(ctx context.Context, k Keyring) context.Context

NewKeyringInContext returns a new context with the keyring set.

Types

type Keyring

type Keyring interface {
	// List returns the names of all keys stored in the keyring.
	List() ([]string, error)

	// LookupAddressByKeyName returns the address of the key with the given name.
	LookupAddressByKeyName(name string) ([]byte, error)

	// GetPubKey returns the public key of the key with the given name.
	GetPubKey(name string) (cryptotypes.PubKey, error)

	// Sign signs the given bytes with the key with the given name.
	Sign(name string, msg []byte, signMode signingv1beta1.SignMode) ([]byte, error)
}

Keyring is an interface used for signing transactions. It aims to be simplistic and easy to use.

type KeyringImpl

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

func NewKeyringImpl

func NewKeyringImpl(k Keyring) *KeyringImpl

func (*KeyringImpl) GetPubKey

func (k *KeyringImpl) GetPubKey(name string) (types.PubKey, error)

GetPubKey implements Keyring.

func (*KeyringImpl) List

func (k *KeyringImpl) List() ([]string, error)

List implements Keyring.

func (*KeyringImpl) LookupAddressByKeyName

func (k *KeyringImpl) LookupAddressByKeyName(name string) ([]byte, error)

LookupAddressByKeyName implements Keyring.

func (*KeyringImpl) Sign

func (k *KeyringImpl) Sign(name string, msg []byte, signMode signingv1beta1.SignMode) ([]byte, error)

Sign implements Keyring.

type NoKeyring

type NoKeyring struct{}

func (NoKeyring) GetPubKey

func (k NoKeyring) GetPubKey(name string) (cryptotypes.PubKey, error)

func (NoKeyring) List

func (k NoKeyring) List() ([]string, error)

func (NoKeyring) LookupAddressByKeyName

func (k NoKeyring) LookupAddressByKeyName(name string) ([]byte, error)

func (NoKeyring) Sign

func (k NoKeyring) Sign(name string, msg []byte, signMode signingv1beta1.SignMode) ([]byte, error)

Jump to

Keyboard shortcuts

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