Documentation ¶
Index ¶
- Constants
- Variables
- func DecodePublicKeyFixedWidth(buf []byte, publicKey *PublicKey) (int, error)
- func EnsureEd25519PrivateKeyCorrect(candidatePrivateKey ed25519.PrivateKey) error
- func PublicKeyLength(curveType CurveType) int
- type Address
- func AddressFromBytes(bs []byte) (address Address, err error)
- func AddressFromHexString(str string) (Address, error)
- func AddressFromWord256(addr binary.Word256) Address
- func MaybeAddressFromBytes(bs []byte) (*Address, error)
- func MustAddressFromBytes(addr []byte) Address
- func NewContractAddress(caller Address, sequence uint64) (newAddr Address)
- func (address Address) Bytes() []byte
- func (address Address) MarshalJSON() ([]byte, error)
- func (address Address) MarshalText() ([]byte, error)
- func (address Address) String() string
- func (address *Address) UnmarshalJSON(data []byte) error
- func (address *Address) UnmarshalText(text []byte) error
- func (address Address) Word256() binary.Word256
- type Addresses
- type CurveType
- type ErrInvalidCurve
- type PrivateKey
- type PublicKey
- func (p PublicKey) ABCIPubKey() abci.PubKey
- func (p PublicKey) Address() Address
- func (p PublicKey) AddressHashType() string
- func (p PublicKey) Encode() []byte
- func (p PublicKey) IsValid() bool
- func (p PublicKey) MarshalJSON() ([]byte, error)
- func (p PublicKey) MarshalText() ([]byte, error)
- func (p PublicKey) RawBytes() []byte
- func (p PublicKey) String() string
- func (p *PublicKey) UnmarshalJSON(text []byte) error
- func (p *PublicKey) UnmarshalText(text []byte) error
- func (p PublicKey) Verify(msg []byte, signature Signature) bool
- type PublicKeyJSON
- type Signable
- type Signature
- type Signer
Constants ¶
const AddressHexLength = 2 * binary.Word160Length
Variables ¶
var ZeroAddress = Address{}
Functions ¶
func DecodePublicKeyFixedWidth ¶
Decodes an encoded public key returning the number of bytes consumed
func EnsureEd25519PrivateKeyCorrect ¶
func EnsureEd25519PrivateKeyCorrect(candidatePrivateKey ed25519.PrivateKey) error
Ensures the last 32 bytes of the ed25519 private key is the public key derived from the first 32 private bytes
func PublicKeyLength ¶
Returns the length in bytes of the public key
Types ¶
type Address ¶
func AddressFromBytes ¶
Returns an address consisting of the first 20 bytes of bs, return an error if the bs does not have length exactly 20 but will still return either: the bytes in bs padded on the right or the first 20 bytes of bs truncated in any case.
func AddressFromHexString ¶
func AddressFromWord256 ¶
func MaybeAddressFromBytes ¶
Returns a pointer to an Address that is nil iff len(bs) == 0 otherwise does the same as AddressFromBytes
func MustAddressFromBytes ¶
func NewContractAddress ¶
func (Address) MarshalJSON ¶
func (Address) MarshalText ¶
func (*Address) UnmarshalJSON ¶
func (*Address) UnmarshalText ¶
type CurveType ¶
type CurveType int8
func CurveTypeFromString ¶
type ErrInvalidCurve ¶
type ErrInvalidCurve string
func (ErrInvalidCurve) Error ¶
func (err ErrInvalidCurve) Error() string
type PrivateKey ¶
func GeneratePrivateKey ¶
func GeneratePrivateKey(random io.Reader, curveType CurveType) (PrivateKey, error)
func PrivateKeyFromRawBytes ¶
func PrivateKeyFromRawBytes(privKeyBytes []byte, curveType CurveType) (PrivateKey, error)
func PrivateKeyFromSecret ¶
func PrivateKeyFromSecret(secret string, curveType CurveType) PrivateKey
func (PrivateKey) GetPublicKey ¶
func (p PrivateKey) GetPublicKey() PublicKey
func (PrivateKey) RawBytes ¶
func (p PrivateKey) RawBytes() []byte
type PublicKey ¶
type PublicKey struct { CurveType CurveType PublicKey []byte // contains filtered or unexported fields }
PublicKey
func PublicKeyFromBytes ¶
Currently this is a stub that reads the raw bytes returned by key_client and returns an ed25519 public key.
func (PublicKey) ABCIPubKey ¶
Return the ABCI PubKey. See Tendermint protobuf.go for the go-crypto conversion this is based on
func (PublicKey) AddressHashType ¶
func (PublicKey) Encode ¶
Produces a binary encoding of the CurveType byte plus the public key for padded to a fixed width on the right
func (PublicKey) MarshalJSON ¶
func (PublicKey) MarshalText ¶
func (*PublicKey) UnmarshalJSON ¶
func (*PublicKey) UnmarshalText ¶
type PublicKeyJSON ¶
type Signable ¶
Signable is an interface for all signable things. It typically removes signatures before serializing.
type Signature ¶
func SignatureFromBytes ¶
Currently this is a stub that reads the raw bytes returned by key_client and returns an ed25519 signature.