Documentation ¶
Overview ¶
This package is a wrapper of verifiable random function using curve secp256r1.
Index ¶
- Variables
- func Evaluate(pri *ecdsa.PrivateKey, h hash.Hash, m []byte) (index [32]byte, proof []byte)
- func ProofToHash(pk *ecdsa.PublicKey, h hash.Hash, m, proof []byte) (index [32]byte, err error)
- func ValidatePrivateKey(pri keypair.PrivateKey) bool
- func ValidatePublicKey(pub keypair.PublicKey) bool
- func Verify(pub keypair.PublicKey, msg, vrf, nizk []byte) (bool, error)
- func Vrf(pri keypair.PrivateKey, msg []byte) (vrf, nizk []byte, err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrKeyNotSupported = errors.New("only support ECC key") ErrEvalVRF = errors.New("failed to evaluate vrf") )
View Source
var ( ErrInvalidVRF = errors.New("invalid VRF proof") ErrInvalidHash = errors.New("hash function does not match elliptic curve bitsize") )
Functions ¶
func ProofToHash ¶
ProofToHash asserts that proof is correct for m and outputs index.
func ValidatePrivateKey ¶
func ValidatePrivateKey(pri keypair.PrivateKey) bool
* ValidatePrivateKey checks two conditions: * - the private key must be of type ec.PrivateKey * - the private key must use curve secp256r1
func ValidatePublicKey ¶
* ValidatePublicKey checks two conditions: * - the public key must be of type ec.PublicKey * - the public key must use curve secp256r1
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.