cosmos-sdk/crypto/keys/multisig/codec.go

36 lines
1.1 KiB
Go

package multisig
import (
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/sr25519"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
)
// TODO: Figure out API for others to either add their own pubkey types, or
// to make verify / marshal accept a AminoCdc.
const (
PubKeyAminoRoute = "tendermint/PubKeyMultisigThreshold"
)
var AminoCdc = codec.NewLegacyAmino()
func init() {
// TODO We now register both Tendermint's PubKey and our own PubKey. In the
// long-term, we should move away from Tendermint's PubKey, and delete this
// first line.
AminoCdc.RegisterInterface((*crypto.PubKey)(nil), nil)
AminoCdc.RegisterInterface((*cryptotypes.PubKey)(nil), nil)
AminoCdc.RegisterConcrete(ed25519.PubKey{},
ed25519.PubKeyName, nil)
AminoCdc.RegisterConcrete(sr25519.PubKey{},
sr25519.PubKeyName, nil)
AminoCdc.RegisterConcrete(&secp256k1.PubKey{},
secp256k1.PubKeyName, nil)
AminoCdc.RegisterConcrete(&LegacyAminoPubKey{},
PubKeyAminoRoute, nil)
}