2018-02-22 07:17:19 -08:00
|
|
|
package client
|
|
|
|
|
|
|
|
import (
|
2018-06-28 17:54:47 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/crypto/keys"
|
2018-07-02 13:34:06 -07:00
|
|
|
dbm "github.com/tendermint/tendermint/libs/db"
|
2018-02-22 07:17:19 -08:00
|
|
|
)
|
|
|
|
|
2018-03-14 12:22:06 -07:00
|
|
|
// GetKeyBase initializes a keybase based on the given db.
|
|
|
|
// The KeyBase manages all activity requiring access to a key.
|
2018-02-28 06:36:04 -08:00
|
|
|
func GetKeyBase(db dbm.DB) keys.Keybase {
|
2018-02-22 07:17:19 -08:00
|
|
|
keybase := keys.New(
|
|
|
|
db,
|
|
|
|
)
|
2018-02-28 06:36:04 -08:00
|
|
|
return keybase
|
2018-02-22 07:17:19 -08:00
|
|
|
}
|
2018-02-22 07:49:32 -08:00
|
|
|
|
|
|
|
// MockKeyBase generates an in-memory keybase that will be discarded
|
|
|
|
// useful for --dry-run to generate a seed phrase without
|
|
|
|
// storing the key
|
|
|
|
func MockKeyBase() keys.Keybase {
|
2018-02-28 06:36:04 -08:00
|
|
|
return GetKeyBase(dbm.NewMemDB())
|
2018-02-22 07:49:32 -08:00
|
|
|
}
|