Documentation ¶
Overview ¶
Copyright 2021 Evmos Foundation This file is part of Evmos' Ethermint library.
The Ethermint library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
The Ethermint library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with the Ethermint library. If not, see https://github.com/brcchain/brcchain/blob/main/LICENSE
Index ¶
- Constants
- Variables
- type PrivKey
- func (privKey PrivKey) Bytes() []byte
- func (*PrivKey) Descriptor() ([]byte, []int)
- func (privKey PrivKey) Equals(other cryptotypes.LedgerPrivKey) bool
- func (m *PrivKey) GetKey() []byte
- func (m *PrivKey) Marshal() (dAtA []byte, err error)
- func (privKey PrivKey) MarshalAmino() ([]byte, error)
- func (privKey PrivKey) MarshalAminoJSON() ([]byte, error)
- func (m *PrivKey) MarshalTo(dAtA []byte) (int, error)
- func (m *PrivKey) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*PrivKey) ProtoMessage()
- func (privKey PrivKey) PubKey() cryptotypes.PubKey
- func (m *PrivKey) Reset()
- func (privKey PrivKey) Sign(digestBz []byte) ([]byte, error)
- func (m *PrivKey) Size() (n int)
- func (m *PrivKey) String() string
- func (privKey PrivKey) ToECDSA() (*ecdsa.PrivateKey, error)
- func (privKey PrivKey) Type() string
- func (m *PrivKey) Unmarshal(dAtA []byte) error
- func (privKey *PrivKey) UnmarshalAmino(bz []byte) error
- func (privKey *PrivKey) UnmarshalAminoJSON(bz []byte) error
- func (m *PrivKey) XXX_DiscardUnknown()
- func (m *PrivKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PrivKey) XXX_Merge(src proto.Message)
- func (m *PrivKey) XXX_Size() int
- func (m *PrivKey) XXX_Unmarshal(b []byte) error
- type PubKey
- func (pubKey PubKey) Address() tmcrypto.Address
- func (pubKey PubKey) Bytes() []byte
- func (*PubKey) Descriptor() ([]byte, []int)
- func (pubKey PubKey) Equals(other cryptotypes.PubKey) bool
- func (m *PubKey) GetKey() []byte
- func (m *PubKey) Marshal() (dAtA []byte, err error)
- func (pubKey PubKey) MarshalAmino() ([]byte, error)
- func (pubKey PubKey) MarshalAminoJSON() ([]byte, error)
- func (m *PubKey) MarshalTo(dAtA []byte) (int, error)
- func (m *PubKey) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*PubKey) ProtoMessage()
- func (m *PubKey) Reset()
- func (m *PubKey) Size() (n int)
- func (pubKey PubKey) String() string
- func (pubKey PubKey) Type() string
- func (m *PubKey) Unmarshal(dAtA []byte) error
- func (pubKey *PubKey) UnmarshalAmino(bz []byte) error
- func (pubKey *PubKey) UnmarshalAminoJSON(bz []byte) error
- func (pubKey PubKey) VerifySignature(msg, sig []byte) bool
- func (m *PubKey) XXX_DiscardUnknown()
- func (m *PubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PubKey) XXX_Merge(src proto.Message)
- func (m *PubKey) XXX_Size() int
- func (m *PubKey) XXX_Unmarshal(b []byte) error
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" )
const ( // PrivKeyName defines the amino encoding name for the EthSecp256k1 private key PrivKeyName = "ethermint/PrivKeyEthSecp256k1" // PubKeyName defines the amino encoding name for the EthSecp256k1 public key PubKeyName = "ethermint/PubKeyEthSecp256k1" )
Amino encoding names
Variables ¶
Functions ¶
This section is empty.
Types ¶
type PrivKey ¶
type PrivKey struct { // key is the private key in byte form Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` }
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 ¶
func (PrivKey) Equals ¶
func (privKey PrivKey) Equals(other cryptotypes.LedgerPrivKey) bool
Equals returns true if two ECDSA private keys are equal and false otherwise.
func (PrivKey) MarshalAmino ¶
MarshalAmino overrides Amino binary marshaling.
func (PrivKey) MarshalAminoJSON ¶
MarshalAminoJSON overrides Amino JSON marshaling.
func (*PrivKey) MarshalToSizedBuffer ¶
func (*PrivKey) ProtoMessage ¶
func (*PrivKey) ProtoMessage()
func (PrivKey) PubKey ¶
func (privKey PrivKey) PubKey() cryptotypes.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.
func (PrivKey) ToECDSA ¶
func (privKey PrivKey) ToECDSA() (*ecdsa.PrivateKey, error)
ToECDSA returns the ECDSA private key as a reference to ecdsa.PrivateKey type.
func (*PrivKey) UnmarshalAmino ¶
UnmarshalAmino overrides Amino binary marshaling.
func (*PrivKey) UnmarshalAminoJSON ¶
UnmarshalAminoJSON overrides Amino JSON marshaling.
func (*PrivKey) XXX_DiscardUnknown ¶
func (m *PrivKey) XXX_DiscardUnknown()
func (*PrivKey) XXX_Marshal ¶
func (*PrivKey) XXX_Unmarshal ¶
type PubKey ¶
type PubKey struct { // key is the public key in byte form Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` }
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 ¶
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 ¶
func (PubKey) Equals ¶
func (pubKey PubKey) Equals(other cryptotypes.PubKey) bool
Equals returns true if the pubkey type is the same and their bytes are deeply equal.
func (PubKey) MarshalAmino ¶
MarshalAmino overrides Amino binary marshaling.
func (PubKey) MarshalAminoJSON ¶
MarshalAminoJSON overrides Amino JSON marshaling.
func (*PubKey) MarshalToSizedBuffer ¶
func (*PubKey) ProtoMessage ¶
func (*PubKey) ProtoMessage()
func (*PubKey) UnmarshalAmino ¶
UnmarshalAmino overrides Amino binary marshaling.
func (*PubKey) UnmarshalAminoJSON ¶
UnmarshalAminoJSON overrides Amino JSON marshaling.
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 and approve verification if the signature can be verified from either the original message or its EIP-712 representation.
CONTRACT: The signature should be in [R || S] format.
func (*PubKey) XXX_DiscardUnknown ¶
func (m *PubKey) XXX_DiscardUnknown()