Kagome
Polkadot Runtime Engine in C++17
ed25519_provider_impl.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CRYPTO_ED25519_PROVIDER_IMPL_H
7 #define KAGOME_CRYPTO_ED25519_PROVIDER_IMPL_H
8 
10 
12 #include "log/logger.hpp"
13 
14 namespace kagome::crypto {
15 
17  public:
18  enum class Error { VERIFICATION_FAILED = 1, SIGN_FAILED };
19 
20  explicit Ed25519ProviderImpl(std::shared_ptr<CSPRNG> generator);
21 
22  Ed25519KeypairAndSeed generateKeypair() const override;
23 
24  Ed25519Keypair generateKeypair(const Ed25519Seed &seed) const override;
25 
26  outcome::result<Ed25519Signature> sign(
27  const Ed25519Keypair &keypair,
28  gsl::span<const uint8_t> message) const override;
29 
30  outcome::result<bool> verify(
31  const Ed25519Signature &signature,
32  gsl::span<const uint8_t> message,
33  const Ed25519PublicKey &public_key) const override;
34 
35  private:
36  std::shared_ptr<CSPRNG> generator_;
38  };
39 
40 } // namespace kagome::crypto
41 
43 
44 #endif // KAGOME_CRYPTO_ED25519_PROVIDER_IMPL_H
outcome::result< bool > verify(const Ed25519Signature &signature, gsl::span< const uint8_t > message, const Ed25519PublicKey &public_key) const override
std::shared_ptr< soralog::Logger > Logger
Definition: logger.hpp:23
Ed25519KeypairAndSeed generateKeypair() const override
Ed25519ProviderImpl(std::shared_ptr< CSPRNG > generator)
outcome::result< Ed25519Signature > sign(const Ed25519Keypair &keypair, gsl::span< const uint8_t > message) const override
OUTCOME_HPP_DECLARE_ERROR(kagome::crypto, Ed25519ProviderImpl::Error)