feat(crypto/keyring): expose db keyring used in the keystore (#24040)
Co-authored-by: Alex | Interchain Labs <alex@interchainlabs.io> Co-authored-by: Tyler <48813565+technicallyty@users.noreply.github.com>
This commit is contained in:
co-authored by
Alex | Interchain Labs
Tyler
parent
f6fa4f25bd
commit
454467d081
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user