Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ZeroPublicKey is an instance of PublicKey consisting of all zeros ZeroPublicKey EC283PublicKey // ZeroPrivateKey is an instance of PrivateKey consisting of all zeros ZeroPrivateKey EC283PrivateKey // ErrPublicKey indicates the error of public key ErrPublicKey = errors.New("invalid public key") // ErrPrivateKey indicates the error of private key ErrPrivateKey = errors.New("invalid private key") )
var ( // ErrInvalidKey is the error that the key format is invalid ErrInvalidKey = errors.New("invalid key format") )
Functions ¶
func StringToPubKeyBytes ¶
StringToPubKeyBytes converts a string of public key to byte slice
Types ¶
type EC283PrivateKey ¶ added in v0.4.4
type EC283PrivateKey [ec283privKeyLength]byte
EC283PrivateKey indicates the type 36 byte public key generated by EC283 library
func BytesToEC283PrivateKey ¶ added in v0.4.4
func BytesToEC283PrivateKey(priKey []byte) (EC283PrivateKey, error)
BytesToEC283PrivateKey converts a byte slice to PrivateKey
type EC283PublicKey ¶ added in v0.4.4
type EC283PublicKey [ec283pubKeyLength]byte
EC283PublicKey indicates the type of 72 byte public key generated by EC283 crypto library
func BytesToEC283PublicKey ¶ added in v0.4.4
func BytesToEC283PublicKey(pubKey []byte) (EC283PublicKey, error)
BytesToEC283PublicKey converts a byte slice to PublicKey
type PrivateKey ¶
type PrivateKey interface { Bytes() []byte HexString() string EcdsaPrivateKey() *ecdsa.PrivateKey PublicKey() PublicKey Sign([]byte) ([]byte, error) }
PrivateKey represents a private key
func BytesToPrivateKey ¶
func BytesToPrivateKey(prvKey []byte) (PrivateKey, error)
BytesToPrivateKey converts a byte slice to SECP256K1 PrivateKey
func GenerateKey ¶ added in v0.5.0
func GenerateKey() (PrivateKey, error)
GenerateKey generates a SECP256K1 PrivateKey
func HexStringToPrivateKey ¶ added in v0.5.0
func HexStringToPrivateKey(prvKey string) (PrivateKey, error)
HexStringToPrivateKey decodes a string to SECP256K1 PrivateKey
type PublicKey ¶
type PublicKey interface { Bytes() []byte HexString() string EcdsaPublicKey() *ecdsa.PublicKey Hash() []byte Verify([]byte, []byte) bool }
PublicKey represents a public key
func BytesToPublicKey ¶
BytesToPublicKey converts a byte slice to SECP256K1 PublicKey
func HexStringToPublicKey ¶ added in v0.5.0
HexStringToPublicKey decodes a string to SECP256K1 PublicKey
func SigToPublicKey ¶
SigToPublicKey returns the uncompressed public key that created the given signature