Documentation ¶
Index ¶
- Constants
- Variables
- func Derive(mnemonic, bip39Passphrase, path string) ([]byte, error)
- func MakePubKey(key []byte) fwcryptotypes.PubKey
- func PubKeyFromBytes(bz []byte) fwcryptotypes.PubKey
- type PrivKey
- func (privKey *PrivKey) Bytes() []byte
- func (*PrivKey) Descriptor() ([]byte, []int)deprecated
- func (privKey *PrivKey) Equals(other fwcryptotypes.LedgerPrivKey) bool
- func (x *PrivKey) GetKey() []byte
- func (*PrivKey) ProtoMessage()
- func (x *PrivKey) ProtoReflect() protoreflect.Message
- func (privKey *PrivKey) PubKey() fwcryptotypes.PubKey
- func (x *PrivKey) Reset()
- func (privKey *PrivKey) Sign(digestBz []byte) ([]byte, error)
- func (x *PrivKey) String() string
- func (privKey *PrivKey) ToECDSA() (*ecdsa.PrivateKey, error)
- func (privKey *PrivKey) Type() string
- type PubKey
- func (pubKey *PubKey) Address() fwcryptotypes.Address
- func (pubKey *PubKey) Bytes() []byte
- func (*PubKey) Descriptor() ([]byte, []int)deprecated
- func (pubKey *PubKey) Equals(other fwcryptotypes.PubKey) bool
- func (x *PubKey) GetKey() []byte
- func (*PubKey) ProtoMessage()
- func (x *PubKey) ProtoReflect() protoreflect.Message
- func (x *PubKey) Reset()
- func (x *PubKey) String() string
- func (pubKey *PubKey) Type() string
- func (pubKey *PubKey) VerifySignature(msg, sig []byte) bool
Constants ¶
const ( // PrivKeySize defines the size of the PrivKey bytes PrivKeySize = 32 // PubKeySize defines the size of the PubKey bytes PubKeySize = 33 // KeyType is the string constant for the Secp256k1 algorithm KeyType = "eth_secp256k1" )
Variables ¶
var File_framework_crypto_secp256k1_keys_proto protoreflect.FileDescriptor
Functions ¶
func Derive ¶
Derive derives and returns the eth_secp256k1 private key for the given mnemonic and HD path.
func MakePubKey ¶
func MakePubKey(key []byte) fwcryptotypes.PubKey
func PubKeyFromBytes ¶
func PubKeyFromBytes(bz []byte) fwcryptotypes.PubKey
Types ¶
type PrivKey ¶
type PrivKey struct { Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // contains filtered or unexported fields }
PrivKey defines a type alias for an ecdsa.PrivateKey that implements Tendermint's PrivateKey interface.
func GenerateKey ¶
GenerateKey generates a new random private key. It returns an error upon failure.
func (*PrivKey) Descriptor
deprecated
func (*PrivKey) Equals ¶
func (privKey *PrivKey) Equals(other fwcryptotypes.LedgerPrivKey) bool
Equals returns true if two ECDSA private keys are equal and false otherwise.
func (*PrivKey) ProtoMessage ¶
func (*PrivKey) ProtoMessage()
func (*PrivKey) ProtoReflect ¶
func (x *PrivKey) ProtoReflect() protoreflect.Message
func (*PrivKey) PubKey ¶
func (privKey *PrivKey) PubKey() fwcryptotypes.PubKey
PubKey returns the ECDSA private key's public key. If the privkey is not valid it returns a nil value.
func (*PrivKey) Sign ¶
Sign creates a recoverable ECDSA signature on the secp256k1 curve over the provided hash of the message. The produced signature is 65 bytes where the last byte contains the recovery ID.
type PubKey ¶
type PubKey struct { Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // contains filtered or unexported fields }
PubKey defines a type alias for an ecdsa.PublicKey that implements Tendermint's PubKey interface. It represents the 33-byte compressed public key format.
func (*PubKey) Address ¶
func (pubKey *PubKey) Address() fwcryptotypes.Address
Address returns the address of the ECDSA public key. The function will return an empty address if the public key is invalid.
func (*PubKey) Descriptor
deprecated
func (*PubKey) Equals ¶
func (pubKey *PubKey) Equals(other fwcryptotypes.PubKey) bool
Equals returns true if the pubkey type is the same and their bytes are deeply equal.
func (*PubKey) ProtoMessage ¶
func (*PubKey) ProtoMessage()
func (*PubKey) ProtoReflect ¶
func (x *PubKey) ProtoReflect() protoreflect.Message
func (*PubKey) VerifySignature ¶
VerifySignature verifies that the ECDSA public key created a given signature over the provided message. It will calculate the Keccak256 hash of the message prior to verification.
CONTRACT: The signature should be in [R || S] format.