Documentation ¶
Index ¶
- Constants
- func Blake2bHash(value []byte) (hash []byte, err error)
- func GenerateHashPair(preimageSize int) (preimage, hash []byte, err error)
- func GenerateSigningKeyPair(publicFileName, privateFileName, curveType string) (err error)
- func ObtainP2PKeypair(pubKeyFile, privKeyFile string) (priv crypto.PrivKey, pub crypto.PubKey, err error)
- func Sha256Hash(value []byte) (hash []byte, err error)
- func SignMessage(privateKey, message []byte, curveType string) ([]byte, error)
- func VerifyMessage(publicKey, message []byte, signature []byte, curveType string) bool
Constants ¶
const ( CurveEd25519 string = "ed25519" CurveSecp256K1 string = "secp256k1" )
Constants shared within subfolders
Variables ¶
This section is empty.
Functions ¶
func Blake2bHash ¶ added in v1.0.0
Blake2bHash wraps inconvenient blake2b_256 hashing ops
func GenerateHashPair ¶
GenerateHashPair generates a preimage and hash pair. This is useful in a commit reveal scheme such as what we use for anchor pre-commit > commit flow.
func GenerateSigningKeyPair ¶
GenerateSigningKeyPair generates based on the curveType and writes keys to file paths given.
func ObtainP2PKeypair ¶
func ObtainP2PKeypair(pubKeyFile, privKeyFile string) (priv crypto.PrivKey, pub crypto.PubKey, err error)
ObtainP2PKeypair obtains a key pair from given file paths
func Sha256Hash ¶
Sha256Hash wraps inconvenient sha256 hashing ops
func SignMessage ¶
SignMessage signs the message using the private key as the curveType provided. if Secp256K1 curve provided, then the signature format is specific to ethereum.
func VerifyMessage ¶
VerifyMessage verifies message using the public key as per the curve type. for Secp256K1 curve the verification is done with ethereum prefix for Secp256K1, public key should be the address of the original public key, following ethereum standards
Types ¶
This section is empty.