Documentation
¶
Overview ¶
Package p256 implements a verifiable random function using curve p256.
Index ¶
Constants ¶
This section is empty.
Variables ¶
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") )
Functions ¶
func GenerateKey ¶
func GenerateKey() (*PrivateKey, *PublicKey)
GenerateKey generates a fresh keypair for this VRF
Types ¶
type PrivateKey ¶
type PrivateKey struct {
*ecdsa.PrivateKey
}
PrivateKey holds a private VRF key.
func NewVRFSigner ¶
func NewVRFSigner(key *ecdsa.PrivateKey) (*PrivateKey, error)
NewVRFSigner creates a signer object from a private key.
func NewVRFSignerFromPEM ¶
func NewVRFSignerFromPEM(b []byte) (*PrivateKey, error)
NewVRFSignerFromPEM creates a vrf private key from a PEM data structure.
func NewVRFSignerFromRawKey ¶
func NewVRFSignerFromRawKey(b []byte) (*PrivateKey, error)
NewVRFSignerFromRawKey returns the private key from a raw private key bytes.
func (PrivateKey) Evaluate ¶
func (k PrivateKey) Evaluate(m []byte) (vrf, proof []byte)
Evaluate returns the verifiable unpredictable function evaluated at m
func (*PrivateKey) Index ¶
func (k *PrivateKey) Index(vrf []byte) [32]byte
Index computes the index for a given vrf output.
type PublicKey ¶
PublicKey holds a public VRF key.
func NewVRFVerifier ¶
NewVRFVerifier creates a verifier object from a public key.
func NewVRFVerifierFromPEM ¶
NewVRFVerifierFromPEM creates a vrf public key from a PEM data structure.
func NewVRFVerifierFromRawKey ¶
NewVRFVerifierFromRawKey returns the public key from a raw public key bytes.