Kagome
Polkadot Runtime Engine in C++17
kagome::crypto::VRFProviderImpl Class Reference

#include <vrf_provider_impl.hpp>

Inheritance diagram for kagome::crypto::VRFProviderImpl:
Collaboration diagram for kagome::crypto::VRFProviderImpl:

Public Member Functions

 VRFProviderImpl (std::shared_ptr< CSPRNG > generator)
 
 ~VRFProviderImpl () override=default
 
Sr25519Keypair generateKeypair () const override
 
std::optional< VRFOutputsign (const common::Buffer &msg, const Sr25519Keypair &keypair, const VRFThreshold &threshold) const override
 
VRFVerifyOutput verify (const common::Buffer &msg, const VRFOutput &output, const Sr25519PublicKey &public_key, const VRFThreshold &threshold) const override
 
std::optional< VRFOutputsignTranscript (const primitives::Transcript &msg, const Sr25519Keypair &keypair, const VRFThreshold &threshold) const override
 
VRFVerifyOutput verifyTranscript (const primitives::Transcript &msg, const VRFOutput &output, const Sr25519PublicKey &public_key, const VRFThreshold &threshold) const override
 
std::optional< VRFOutputsignTranscript (const primitives::Transcript &msg, const Sr25519Keypair &keypair) const override
 
- Public Member Functions inherited from kagome::crypto::VRFProvider
virtual ~VRFProvider ()=default
 

Private Member Functions

std::optional< VRFOutputsignTranscriptImpl (const primitives::Transcript &msg, const Sr25519Keypair &keypair, const std::optional< std::reference_wrapper< const VRFThreshold >> threshold) const
 

Private Attributes

std::shared_ptr< CSPRNGgenerator_
 

Static Private Attributes

static constexpr VRFThreshold kMaxThreshold
 

Detailed Description

Definition at line 18 of file vrf_provider_impl.hpp.

Constructor & Destructor Documentation

kagome::crypto::VRFProviderImpl::VRFProviderImpl ( std::shared_ptr< CSPRNG generator)
explicit

Definition at line 15 of file vrf_provider_impl.cpp.

kagome::crypto::VRFProviderImpl::~VRFProviderImpl ( )
overridedefault

Member Function Documentation

Sr25519Keypair kagome::crypto::VRFProviderImpl::generateKeypair ( ) const
overridevirtual

Generates random keypair for signing the message

Implements kagome::crypto::VRFProvider.

Definition at line 18 of file vrf_provider_impl.cpp.

std::optional< VRFOutput > kagome::crypto::VRFProviderImpl::sign ( const common::Buffer msg,
const Sr25519Keypair keypair,
const VRFThreshold threshold 
) const
overridevirtual

Sign message

Parameters
msgusing
keypair.If computed value is less than
thresholdthen return optional containing this value and proof. Otherwise none returned

Implements kagome::crypto::VRFProvider.

Definition at line 98 of file vrf_provider_impl.cpp.

std::optional< VRFOutput > kagome::crypto::VRFProviderImpl::signTranscript ( const primitives::Transcript msg,
const Sr25519Keypair keypair,
const VRFThreshold threshold 
) const
overridevirtual

Sign transcript message

Parameters
msgusing
keypair.If computed value is less than
thresholdthen return optional containing this value and proof. Otherwise none returned

Implements kagome::crypto::VRFProvider.

Definition at line 35 of file vrf_provider_impl.cpp.

std::optional< VRFOutput > kagome::crypto::VRFProviderImpl::signTranscript ( const primitives::Transcript msg,
const Sr25519Keypair keypair 
) const
overridevirtual

Sign transcript message

Parameters
msgusing
keypairwithout any threshold check. Returns proof if no error happened.

Implements kagome::crypto::VRFProvider.

Definition at line 42 of file vrf_provider_impl.cpp.

std::optional< VRFOutput > kagome::crypto::VRFProviderImpl::signTranscriptImpl ( const primitives::Transcript msg,
const Sr25519Keypair keypair,
const std::optional< std::reference_wrapper< const VRFThreshold >>  threshold 
) const
private

Definition at line 47 of file vrf_provider_impl.cpp.

VRFVerifyOutput kagome::crypto::VRFProviderImpl::verify ( const common::Buffer msg,
const VRFOutput output,
const Sr25519PublicKey &  public_key,
const VRFThreshold threshold 
) const
overridevirtual

Verifies that

Parameters
outputwas derived using
public_keyon
msg

Implements kagome::crypto::VRFProvider.

Definition at line 128 of file vrf_provider_impl.cpp.

VRFVerifyOutput kagome::crypto::VRFProviderImpl::verifyTranscript ( const primitives::Transcript msg,
const VRFOutput output,
const Sr25519PublicKey &  public_key,
const VRFThreshold threshold 
) const
overridevirtual

Verifies that

Parameters
outputwas derived using
public_keyon transcript
msg

Implements kagome::crypto::VRFProvider.

Definition at line 82 of file vrf_provider_impl.cpp.

Member Data Documentation

std::shared_ptr<CSPRNG> kagome::crypto::VRFProviderImpl::generator_
private

Definition at line 60 of file vrf_provider_impl.hpp.

constexpr VRFThreshold kagome::crypto::VRFProviderImpl::kMaxThreshold
staticprivate
Initial value:
{
std::numeric_limits<VRFThreshold>::max()}

Definition at line 19 of file vrf_provider_impl.hpp.


The documentation for this class was generated from the following files: