Documentation ¶
Index ¶
- Constants
- func EcRecover(msg, signature []byte) ([]byte, error)
- func PublicKeyForSecpSecretKey(sk []byte) []byte
- func SignBLS(sk, msg []byte) ([]byte, error)
- func SignSecp(sk, msg []byte) ([]byte, error)
- func ValidateBlsSignature(data []byte, addr address.Address, signature []byte) error
- func ValidateSecpSignature(data []byte, addr address.Address, signature []byte) error
- func ValidateSignature(data []byte, addr address.Address, sig Signature) error
- func VerifyBLS(pubKey, msg, signature []byte) bool
- func VerifyBLSAggregate(pubKeys, msgs [][]byte, signature []byte) bool
- func VerifySecp(pk, msg, signature []byte) bool
- type KeyInfo
- func (ki *KeyInfo) Address() (address.Address, error)
- func (ki *KeyInfo) Equals(other *KeyInfo) bool
- func (ki *KeyInfo) Key() []byte
- func (ki KeyInfo) MarshalJSON() ([]byte, error)
- func (ki *KeyInfo) PublicKey() ([]byte, error)
- func (ki *KeyInfo) SetPrivateKey(privateKey []byte)
- func (ki *KeyInfo) Type() SigType
- func (ki *KeyInfo) UnmarshalJSON(data []byte) error
- func (ki *KeyInfo) UsePrivateKey(f func([]byte) error) error
- type SigType
- type Signature
Constants ¶
const ( SigTypeSecp256k1 = crypto.SigTypeSecp256k1 SigTypeBLS = crypto.SigTypeBLS )
const PrivateKeyBytes = 32
PrivateKeyBytes is the size of a serialized private key.
Variables ¶
This section is empty.
Functions ¶
func PublicKeyForSecpSecretKey ¶
PublicKeyForSecpSecretKey returns the public key for this private key.
func SignSecp ¶
SignSecp signs the given message using secp256k1 based cryptography, which must be 32 bytes long.
func ValidateBlsSignature ¶
func ValidateSecpSignature ¶
func ValidateSignature ¶
ValidateSignature cryptographically verifies that 'sig' is the signed hash of 'data' with the public key belonging to `addr`.
func VerifyBLSAggregate ¶
VerifyBLSAggregate checks the given signature is a valid aggregate signature over all messages and public keys
func VerifySecp ¶
VerifySecp checks the given signature is a secp256k1 signature and returns true if it is valid.
Types ¶
type KeyInfo ¶
type KeyInfo struct { // Private key. PrivateKey *memguard.Enclave `json:"privateKey"` // Cryptographic system used to generate private key. SigType SigType `json:"type"` }
KeyInfo is a key and its type used for signing.
func NewSecpKeyFromSeed ¶
NewSecpKeyFromSeed generates a new key from the given reader.
func (*KeyInfo) Key ¶
Key returns the private key of KeyInfo This method makes the key escape from memguard's protection, so use caution