Documentation ¶
Index ¶
- Variables
- func GenerateKey() (vrf.PrivateKey, vrf.PublicKey)
- func H1(m []byte) (x, y *big.Int)
- func H2(m []byte) *big.Int
- func NewVRFSigner(key *ecdsa.PrivateKey) (vrf.PrivateKey, error)
- func NewVRFVerifier(pubkey *ecdsa.PublicKey) (vrf.PublicKey, error)
- func Unmarshal(curve elliptic.Curve, data []byte) (x, y *big.Int)
- type PrivateKey
- type PublicKey
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrPointNotOnCurve occurs when a public key is not on the curve. ErrPointNotOnCurve = errors.New("point is not on the P256 curve") // ErrWrongKeyType occurs when a key is not an ECDSA key. ErrWrongKeyType = errors.New("not an ECDSA key") // ErrNoPEMFound occurs when attempting to parse a non PEM data structure. ErrNoPEMFound = errors.New("no PEM block found") // ErrInvalidVRF occurs when the VRF does not validate. ErrInvalidVRF = errors.New("invalid VRF proof") // ErrEvaluateFailed fail ErrEvaluateFailed = errors.New("failed to evaluate VRF") )
Functions ¶
func GenerateKey ¶
func GenerateKey() (vrf.PrivateKey, vrf.PublicKey)
GenerateKey generates a fresh keypair for this VRF
func NewVRFSigner ¶
func NewVRFSigner(key *ecdsa.PrivateKey) (vrf.PrivateKey, error)
NewVRFSigner creates a signer object from a private key.
func NewVRFVerifier ¶
NewVRFVerifier creates a verifier object from a public key.
Types ¶
type PrivateKey ¶
type PrivateKey struct {
*ecdsa.PrivateKey
}
PrivateKey holds a private VRF key.
func (PrivateKey) Evaluate ¶
func (k PrivateKey) Evaluate(m []byte) (index [32]byte, proof []byte)
Evaluate returns the verifiable unpredictable function evaluated at m
func (PrivateKey) Public ¶
func (k PrivateKey) Public() crypto.PublicKey
Public returns the corresponding public key as bytes.
Click to show internal directories.
Click to hide internal directories.