Documentation ¶
Index ¶
- func GenerateSigningKeyPair() (publicKey, privateKey []byte, err error)
- func GetAddress(publicKey []byte) string
- func GetPrivateSigningKey(fileName string) (key []byte, err error)
- func GetPublicSigningKey(fileName string) (key []byte, err error)
- func GetSigningKeyPair(pub, priv string) (public, private []byte, err error)
- func Hash(data []byte) []byte
- func HashWithEthPrefix(data []byte) []byte
- func Sign(message []byte, privateKey []byte) (signature []byte, err error)
- func SignEthereum(message []byte, privateKey []byte) (signature []byte, err error)
- func VerifySignature(publicKey, message, signature []byte) bool
- func VerifySignatureWithAddress(address, sigHex string, msg []byte) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateSigningKeyPair ¶
GenerateSigningKeyPair generates secp2562k1 based keys.
func GetAddress ¶
GetAddress returns the hex of first 20 bytes of the Keccak256 has of public keuy
func GetPrivateSigningKey ¶
GetPrivateSigningKey returns the private key from the file
func GetPublicSigningKey ¶
GetPublicSigningKey returns the public key from the file
func GetSigningKeyPair ¶
GetSigningKeyPair returns the public and private keys as byte array
func HashWithEthPrefix ¶
HashWithEthPrefix returns the hash of the data. The hash is calculated as keccak256("\x19Ethereum Signed Message:\n"${message length}${message}). for further details see https://github.com/ethereum/go-ethereum/blob/55599ee95d4151a2502465e0afc7c47bd1acba77/internal/ethapi/api.go#L404
func Sign ¶
Sign signs the message using private key We do hash the message since it not recommended to use the message as is.
func SignEthereum ¶
SignEthereum converts message to ethereum specific format and signs it.
func VerifySignature ¶
VerifySignature verifies signature using the public key provided.
func VerifySignatureWithAddress ¶
VerifySignatureWithAddress verifies the signature using address provided
Types ¶
This section is empty.