key

package
v0.0.0-...-7ea54e2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenPrivateKey

func GenPrivateKey() ([]byte, error)

GenPrivateKey generates a new private key, and return privates key in bytes, as well as error if exists.

func PrivateKeyToAddress

func PrivateKeyToAddress(privateKey []byte) (string, error)

PrivateKeyToAddress converts bytes private key to Ethereum-like address.

func PrivateKeyToPublicKey

func PrivateKeyToPublicKey(privateKey []byte) ([]byte, error)

PrivateKeyToPublicKey retrieves the public key in bytes corresponding to the given bytes private key.

func PublicKeyToAddress

func PublicKeyToAddress(publicKey []byte) (string, error)

func SignData

func SignData(privateKey []byte, data []byte) ([]byte, error)

SignData signs arbitrary bytes with private key and returns the signature in bytes.

func VerifySignatureWithAddress

func VerifySignatureWithAddress(address string, signature []byte, data []byte) (bool, error)

VerifySignatureWithAddress verifies a bytes signature with given address and the data used for this signature. Returns true if the signature matches the public key.

func VerifySignatureWithPublicKey

func VerifySignatureWithPublicKey(publicKey []byte, signature []byte, data []byte) (bool, error)

VerifySignatureWithPublicKey verifies a bytes signature with given public key in bytes and the data used for this signature. Returns true if the signature matches the public key.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL