Documentation ¶
Overview ¶
* @author PalletOne core developers <dev@pallet.one> * @date 2018
* @author PalletOne core developers <dev@pallet.one> * @date 2018
Index ¶
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 S256 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() (IPrivateKey, IPublicKey)
GenerateKey generates a fresh keypair for this VRF
Types ¶
type IPrivateKey ¶
type IPrivateKey interface { // Evaluate returns the output of H(f_k(m)) and its proof. Evaluate(m []byte) (index [32]byte, proof []byte) // Public returns the corresponding public key. Public() crypto.PublicKey }
PrivateKey supports evaluating the VRF function.
type IPublicKey ¶
type IPublicKey interface { // ProofToHash verifies the NP-proof supplied by Proof and outputs Index. ProofToHash(m, proof []byte) (index [32]byte, err error) }
PublicKey supports verifying output from the VRF function.
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 (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.
type PublicKey ¶
PublicKey holds a public VRF key.
func NewVRFVerifier ¶
NewVRFVerifier creates a verifier object from a public key.
Click to show internal directories.
Click to hide internal directories.