Documentation
¶
Index ¶
- func GenPrivateKey() ([]byte, error)
- func PrivateKeyToAddress(privateKey []byte) (string, error)
- func PrivateKeyToPublicKey(privateKey []byte) ([]byte, error)
- func PublicKeyToAddress(publicKey []byte) (string, error)
- func SignData(privateKey []byte, data []byte) ([]byte, error)
- func VerifySignatureWithAddress(address string, signature []byte, data []byte) (bool, error)
- func VerifySignatureWithPublicKey(publicKey []byte, signature []byte, data []byte) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenPrivateKey ¶
GenPrivateKey generates a new private key, and return privates key in bytes, as well as error if exists.
func PrivateKeyToAddress ¶
PrivateKeyToAddress converts bytes private key to Ethereum-like address.
func PrivateKeyToPublicKey ¶
PrivateKeyToPublicKey retrieves the public key in bytes corresponding to the given bytes private key.
func PublicKeyToAddress ¶
func VerifySignatureWithAddress ¶
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 ¶
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.
Click to show internal directories.
Click to hide internal directories.