From c4308d2da05bd3943ab019e9903d6e36a81126fd Mon Sep 17 00:00:00 2001 From: mmsqe Date: Thu, 9 May 2024 19:33:38 +0800 Subject: [PATCH] feat(crypto/keyring): expose db keyring used in the keystore (#20212) Co-authored-by: Julien Robert --- CHANGELOG.md | 1 + crypto/keyring/keyring.go | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf3984587ab..0017d27cec8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,6 +59,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 diff --git a/crypto/keyring/keyring.go b/crypto/keyring/keyring.go index d5392821404..c125383d543 100644 --- a/crypto/keyring/keyring.go +++ b/crypto/keyring/keyring.go @@ -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) @@ -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 {