github.com/cosmos/cosmos-sdk@v0.50.1/crypto/types/types.go (about) 1 package types 2 3 import ( 4 cmtcrypto "github.com/cometbft/cometbft/crypto" 5 proto "github.com/cosmos/gogoproto/proto" 6 ) 7 8 // PubKey defines a public key and extends proto.Message. 9 type PubKey interface { 10 proto.Message 11 12 Address() Address 13 Bytes() []byte 14 VerifySignature(msg, sig []byte) bool 15 Equals(PubKey) bool 16 Type() string 17 } 18 19 // LedgerPrivKey defines a private key that is not a proto message. For now, 20 // LedgerSecp256k1 keys are not converted to proto.Message yet, this is why 21 // they use LedgerPrivKey instead of PrivKey. All other keys must use PrivKey 22 // instead of LedgerPrivKey. 23 // TODO https://github.com/cosmos/cosmos-sdk/issues/7357. 24 type LedgerPrivKey interface { 25 Bytes() []byte 26 Sign(msg []byte) ([]byte, error) 27 PubKey() PubKey 28 Equals(LedgerPrivKey) bool 29 Type() string 30 } 31 32 // LedgerPrivKeyAminoJSON is a Ledger PrivKey type that supports signing with 33 // SIGN_MODE_LEGACY_AMINO_JSON. It is added as a non-breaking change, instead of directly 34 // on the LedgerPrivKey interface (whose Sign method will sign with TEXTUAL), 35 // and will be deprecated/removed once LEGACY_AMINO_JSON is removed. 36 type LedgerPrivKeyAminoJSON interface { 37 LedgerPrivKey 38 // SignLedgerAminoJSON signs a messages on the Ledger device using 39 // SIGN_MODE_LEGACY_AMINO_JSON. 40 SignLedgerAminoJSON(msg []byte) ([]byte, error) 41 } 42 43 // PrivKey defines a private key and extends proto.Message. For now, it extends 44 // LedgerPrivKey (see godoc for LedgerPrivKey). Ultimately, we should remove 45 // LedgerPrivKey and add its methods here directly. 46 // TODO https://github.com/cosmos/cosmos-sdk/issues/7357. 47 type PrivKey interface { 48 proto.Message 49 LedgerPrivKey 50 } 51 52 type ( 53 Address = cmtcrypto.Address 54 )