keyring

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package keyring provides multi-keyring management for akt.

It wraps the Cosmos SDK's crypto/keyring package, adding support for multiple named keyrings that can be shared across contexts.

Each named keyring maps to a Cosmos SDK keyring.Keyring instance backed by a specific backend (os, file, test, kwallet, pass) and directory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyOverrides added in v0.0.4

func ApplyOverrides(keyrings []aktctx.Keyring, backend, dir string) []aktctx.Keyring

ApplyOverrides returns keyring configurations with the per-invocation --keyring-backend / --keyring-dir overrides (SPEC §3.1) applied. Empty overrides leave the persisted configuration untouched, so an unset flag can never shadow a context's stored backend.

func Backends added in v0.0.4

func Backends() []string

Backends returns every keyring backend akt accepts, in the order they are offered to users (SPEC §1.5).

func DefaultAlgo

func DefaultAlgo() sdkkeyring.SignatureAlgo

DefaultAlgo returns the default signing algorithm (secp256k1).

func EffectiveBackend added in v0.0.4

func EffectiveBackend(root string, kr aktctx.Keyring) (string, bool)

EffectiveBackend reports the concrete credential store that serves kr's configured backend on this host, and whether the host can provide it at all.

Only "os" is an alias: every other backend is pinned by the SDK to exactly one store, so it is its own effective backend. Resolution is inspection only — it never reads a key, unlocks a store, or prompts.

func NewDeferred added in v0.0.4

func NewDeferred(backend string, loader DeferredLoader) sdkkeyring.Keyring

NewDeferred returns a keyring proxy that invokes loader on its first key operation. It is used by public reads that may need a named default account later but must not prompt merely because the context has one configured.

func NewInMemory

func NewInMemory(cdc codec.Codec) sdkkeyring.Keyring

NewInMemory creates an in-memory keyring for dry-run / testing use. It is not associated with any named keyring in the config.

func SystemBackendNames added in v0.0.4

func SystemBackendNames() []string

SystemBackendNames names the credential stores that can serve the "os" backend on this platform, whether or not they are present.

func SystemKeyringAvailable added in v0.0.4

func SystemKeyringAvailable() bool

SystemKeyringAvailable reports whether this host provides a credential store that can serve the "os" backend (SPEC §1.5). Offering "os" where this is false hands the user a backend that silently becomes something else.

func ValidateBackend added in v0.0.4

func ValidateBackend(backend string) error

ValidateBackend reports whether backend names a keyring akt can open. An empty value means "unset" and is accepted: callers treat it as "inherit the configured backend".

Types

type DeferredLoader added in v0.0.4

type DeferredLoader func() (sdkkeyring.Keyring, error)

DeferredLoader opens the configured keyring when an operation first needs key material. The returned keyring or error is cached for the process.

type Manager

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

Manager manages multiple named keyrings. It lazily opens keyrings on first access and caches them for the lifetime of the process. Manager is safe for concurrent use.

func NewManager

func NewManager(root string, keyrings []aktctx.Keyring, cdc codec.Codec) *Manager

NewManager creates a keyring manager from the config root and keyring definitions. The codec is required by the Cosmos SDK keyring for protobuf key serialization.

func (*Manager) Deferred added in v0.0.4

func (m *Manager) Deferred(name string) sdkkeyring.Keyring

Deferred returns a proxy that opens the named keyring on its first key operation. Inspecting Backend does not open the configured store.

func (*Manager) EffectiveBackend added in v0.0.4

func (m *Manager) EffectiveBackend(name string) (string, bool)

EffectiveBackend reports the concrete credential store that serves the named keyring on this host (SPEC §1.5), and whether the host can provide it.

func (*Manager) Get

func (m *Manager) Get(name string) (sdkkeyring.Keyring, error)

Get returns the Cosmos SDK keyring for the given named keyring. The keyring is lazily opened on first access and cached.

func (*Manager) Names

func (m *Manager) Names() []string

Names returns the names of all configured keyrings.

func (*Manager) Reload

func (m *Manager) Reload(keyrings []aktctx.Keyring)

Reload updates the keyring configurations (e.g., after config live-reload). Cached keyrings whose config changed are evicted.

func (*Manager) SetInput

func (m *Manager) SetInput(r io.Reader)

SetInput sets the reader used for password prompts, shared with the commands.

type UnavailableBackendError added in v0.0.4

type UnavailableBackendError struct {
	// Keyring is the configured keyring name, e.g. "default".
	Keyring string
	// Backend is the configured backend, e.g. "os".
	Backend string
	// Expected lists the platform stores that could have served Backend.
	Expected []string
}

UnavailableBackendError reports a configured keyring backend that this host cannot provide. It is deliberately fatal rather than a fallback: substituting a different credential store would move the user's keys without telling them (SPEC §1.5).

func (*UnavailableBackendError) Error added in v0.0.4

func (e *UnavailableBackendError) Error() string

Jump to

Keyboard shortcuts

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