Kagome
Polkadot Runtime Engine in C++17
sr25519_provider_impl.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CORE_CRYPTO_SR25519_SR25519_PROVIDER_IMPL_HPP
7 #define KAGOME_CORE_CRYPTO_SR25519_SR25519_PROVIDER_IMPL_HPP
8 
11 
13  class CSPRNG;
14 }
15 
16 namespace kagome::crypto {
17 
20 
21  public:
22  explicit Sr25519ProviderImpl(std::shared_ptr<CSPRNG> generator);
23 
24  ~Sr25519ProviderImpl() override = default;
25 
26  Sr25519KeypairAndSeed generateKeypair() const override;
27 
28  Sr25519Keypair generateKeypair(const Sr25519Seed &seed) const override;
29 
30  outcome::result<Sr25519Signature> sign(
31  const Sr25519Keypair &keypair,
32  gsl::span<const uint8_t> message) const override;
33 
34  outcome::result<bool> verify_deprecated(
35  const Sr25519Signature &signature,
36  gsl::span<const uint8_t> message,
37  const Sr25519PublicKey &public_key) const override;
38 
39  outcome::result<bool> verify(
40  const Sr25519Signature &signature,
41  gsl::span<const uint8_t> message,
42  const Sr25519PublicKey &public_key) const override;
43 
44  private:
45  std::shared_ptr<CSPRNG> generator_;
46  };
47 
48 } // namespace kagome::crypto
49 
50 #endif // KAGOME_CORE_CRYPTO_SR25519_SR25519_PROVIDER_IMPL_HPP
libp2p::crypto::random::CSPRNG CSPRNG
libp2p::crypto::random::CSPRNG CSPRNG