Kagome
Polkadot Runtime Engine in C++17
vrf_provider.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CORE_CRYPTO_VRF_VRF_PROVIDER_HPP
7 #define KAGOME_CORE_CRYPTO_VRF_VRF_PROVIDER_HPP
8 
9 #include <optional>
10 
11 #include "common/buffer.hpp"
12 #include "crypto/sr25519_types.hpp"
14 
15 namespace kagome::crypto {
16 
20  class VRFProvider {
21  public:
22  virtual ~VRFProvider() = default;
23 
27  virtual Sr25519Keypair generateKeypair() const = 0;
28 
34  virtual std::optional<VRFOutput> sign(
35  const common::Buffer &msg,
36  const Sr25519Keypair &keypair,
37  const VRFThreshold &threshold) const = 0;
38 
43  virtual VRFVerifyOutput verify(const common::Buffer &msg,
44  const VRFOutput &output,
45  const Sr25519PublicKey &public_key,
46  const VRFThreshold &threshold) const = 0;
47 
53  virtual std::optional<VRFOutput> signTranscript(
54  const primitives::Transcript &msg,
55  const Sr25519Keypair &keypair,
56  const VRFThreshold &threshold) const = 0;
57 
62  virtual std::optional<VRFOutput> signTranscript(
63  const primitives::Transcript &msg,
64  const Sr25519Keypair &keypair) const = 0;
65 
71  const primitives::Transcript &msg,
72  const VRFOutput &output,
73  const Sr25519PublicKey &public_key,
74  const VRFThreshold &threshold) const = 0;
75  };
76 } // namespace kagome::crypto
77 
78 #endif // KAGOME_CORE_CRYPTO_VRF_VRF_PROVIDER_HPP
Class represents arbitrary (including empty) byte buffer.
Definition: buffer.hpp:29
virtual VRFVerifyOutput verify(const common::Buffer &msg, const VRFOutput &output, const Sr25519PublicKey &public_key, const VRFThreshold &threshold) const =0
boost::multiprecision::uint128_t VRFThreshold
virtual std::optional< VRFOutput > sign(const common::Buffer &msg, const Sr25519Keypair &keypair, const VRFThreshold &threshold) const =0
virtual std::optional< VRFOutput > signTranscript(const primitives::Transcript &msg, const Sr25519Keypair &keypair, const VRFThreshold &threshold) const =0
virtual ~VRFProvider()=default
virtual VRFVerifyOutput verifyTranscript(const primitives::Transcript &msg, const VRFOutput &output, const Sr25519PublicKey &public_key, const VRFThreshold &threshold) const =0
virtual Sr25519Keypair generateKeypair() const =0