crypto/keyring: `Keybase` interface gives way to its successor: `Keyring`. `LegacyKeybase` interface is added in order to guarantee limited backward compatibility with the old `Keybase` interface for the sole purpose of migrating keys across the new keyring backends. The package no longer depends on the `github.com/types.Config` singleton. `SupportedAlgos` and `SupportedLedgerAlgos` methods have been removed. The keyring just fails when trying to perform an action with an unsupported algorithm. crypto/ subdirs reorganization: `crypto/keys/hd` was moved to `crypto/hd`, which now groups together all HD wallets related types and utilities. client/input: * Removal of unnecessary `GetCheckPassword`, `PrintPrefixed` functions. * `GetConfirmation`'s signature changed to take in a io.Writer for better integration with `cobra.Command` types. client/context: * In-memory keyring is allocated in the context when `--gen-only` flag is passed in. `GetFromFields` does no longer silently allocate a keyring, it takes one as argument. Co-authored with @jgimeno Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
29 lines
891 B
Go
29 lines
891 B
Go
package keyring
|
|
|
|
import (
|
|
cryptoAmino "github.com/tendermint/tendermint/crypto/encoding/amino"
|
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
"github.com/cosmos/cosmos-sdk/crypto/hd"
|
|
)
|
|
|
|
// CryptoCdc defines the codec required for keys and info
|
|
var CryptoCdc *codec.Codec
|
|
|
|
func init() {
|
|
CryptoCdc = codec.New()
|
|
cryptoAmino.RegisterAmino(CryptoCdc)
|
|
RegisterCodec(CryptoCdc)
|
|
CryptoCdc.Seal()
|
|
}
|
|
|
|
// RegisterCodec registers concrete types and interfaces on the given codec.
|
|
func RegisterCodec(cdc *codec.Codec) {
|
|
cdc.RegisterInterface((*Info)(nil), nil)
|
|
cdc.RegisterConcrete(hd.BIP44Params{}, "crypto/keys/hd/BIP44Params", nil)
|
|
cdc.RegisterConcrete(localInfo{}, "crypto/keys/localInfo", nil)
|
|
cdc.RegisterConcrete(ledgerInfo{}, "crypto/keys/ledgerInfo", nil)
|
|
cdc.RegisterConcrete(offlineInfo{}, "crypto/keys/offlineInfo", nil)
|
|
cdc.RegisterConcrete(multiInfo{}, "crypto/keys/multiInfo", nil)
|
|
}
|