diff --git a/CHANGELOG.md b/CHANGELOG.md index 58860259a8..e8d95c5d48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features +* (crypto/keyring) [#24040](https://github.com/cosmos/cosmos-sdk/pull/24040) Expose the db keyring used in the keystore. * (types) [#23919](https://github.com/cosmos/cosmos-sdk/pull/23919) Add MustValAddressFromBech32 function. * (all) [#23708](https://github.com/cosmos/cosmos-sdk/pull/23708) Add unordered transaction support. * Adds a `--timeout-timestamp` flag that allows users to specify a block time at which the unordered transactions should expire from the mempool. diff --git a/crypto/keyring/keyring.go b/crypto/keyring/keyring.go index 6598aa8873..4336772547 100644 --- a/crypto/keyring/keyring.go +++ b/crypto/keyring/keyring.go @@ -50,8 +50,9 @@ const ( ) var ( - _ Keyring = &keystore{} - maxPassphraseEntryAttempts = 3 + _ Keyring = &keystore{} + _ KeyringWithDB = &keystore{} + maxPassphraseEntryAttempts = 3 ) // Keyring exposes operations over a backend supported by github.com/99designs/keyring. @@ -104,6 +105,13 @@ type Keyring interface { Migrator } +type KeyringWithDB interface { + Keyring + + // Get the db keyring used in the keystore. + DB() keyring.Keyring +} + // Signer is implemented by key stores that want to provide signing capabilities. type Signer interface { // Sign sign byte messages with a user key. @@ -258,6 +266,11 @@ func (ks keystore) ExportPubKeyArmor(uid string) (string, error) { return crypto.ArmorPubKeyBytes(bz, key.Type()), nil } +// DB returns the db keyring used in the keystore +func (ks keystore) DB() keyring.Keyring { + return ks.db +} + func (ks keystore) ExportPubKeyArmorByAddress(address sdk.Address) (string, error) { k, err := ks.KeyByAddress(address) if err != nil {