Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(crypto/keyring): expose db keyring used in the keystore #20212

Merged
merged 4 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
* (x/consensus) [#19483](https://github.com/cosmos/cosmos-sdk/pull/19483) Add consensus messages registration to consensus module.
* (types) [#19759](https://github.com/cosmos/cosmos-sdk/pull/19759) Align SignerExtractionAdapter in PriorityNonceMempool Remove.
* (client) [#19870](https://github.com/cosmos/cosmos-sdk/pull/19870) Add new query command `wait-tx`. Alias `event-query-tx-for` to `wait-tx` for backward compatibility.
* (crypto/keyring) [#20212](https://github.com/cosmos/cosmos-sdk/pull/20212) Expose the db keyring used in the keystore.
* (genutil) [#19971](https://github.com/cosmos/cosmos-sdk/pull/19971) Allow manually setting the consensus key type in genesis

### Improvements
Expand Down
9 changes: 9 additions & 0 deletions crypto/keyring/keyring.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ var (
type Keyring interface {
// Backend get the backend type used in the keyring config: "file", "os", "kwallet", "pass", "test", "memory".
Backend() string

// Get the db keyring used in the keystore.
DB() keyring.Keyring

// List all keys.
List() ([]*Record, error)

Expand Down Expand Up @@ -256,6 +260,11 @@ func (ks keystore) Backend() string {
return ks.backend
}

// DB returns the db keyring used in the keystore
func (ks keystore) DB() keyring.Keyring {
return ks.db
}

func (ks keystore) ExportPubKeyArmor(uid string) (string, error) {
k, err := ks.Key(uid)
if err != nil {
Expand Down
Loading