cardano::VRFPublicKey class

Represents a VRF public key.

This class is a wrapper around the ed25519::PublicKey class. As such, it inherits all of its methods. It adds the ability to verify a VRF proof.

Base classes

class PublicKey
Represent an Ed25519 prublic key.

Derived classes

class VrfVerificationKey
A VRF verification key used by stake pools to verify leadership selection.

Constructors, destructors, conversion operators

VRFPublicKey(std::span<const uint8_t, VRF_PUBLIC_KEY_SIZE> pub) explicit
Construct a key object from a span of key bytes.

Public functions

auto bytes() const →  const PubKeyByteArray& constexpr
Return a constant reference to the public key byte array.
auto verifyProof(std::span<const uint8_t> msg, std::span<const uint8_t> proof) const →  bool
Verify a VRF proof from the associated secret key.
auto verifySignature(std::span<const uint8_t> msg, std::span<const uint8_t, SIGNATURE_SIZE> sig) const →  bool
Verify a signature using the public key.

Function documentation

cardano::VRFPublicKey::VRFPublicKey(std::span<const uint8_t, VRF_PUBLIC_KEY_SIZE> pub) explicit

Construct a key object from a span of key bytes.

Parameters
pub A span of 32 bytes that will be copied into the object.

bool cardano::VRFPublicKey::verifyProof(std::span<const uint8_t> msg, std::span<const uint8_t> proof) const

Verify a VRF proof from the associated secret key.

Parameters
msg The message from which the proof and hash were derived.
proof The proof to verify.
Returns True if the proof is valid, false otherwise.