Kagome
Polkadot Runtime Engine in C++17
ecdsa_provider.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CORE_CRYPTO_ECDSA_PROVIDER_HPP
7 #define KAGOME_CORE_CRYPTO_ECDSA_PROVIDER_HPP
8 
9 #include <gsl/span>
10 
11 #include "outcome/outcome.hpp"
12 
13 #include "crypto/ecdsa_types.hpp"
14 
15 namespace kagome::crypto {
16 
17  class EcdsaProvider {
18  public:
19  virtual ~EcdsaProvider() = default;
20 
21  virtual outcome::result<EcdsaKeypairAndSeed> generate() const = 0;
22 
23  virtual outcome::result<EcdsaPublicKey> derive(
24  const EcdsaSeed &seed) const = 0;
25 
26  virtual outcome::result<EcdsaSignature> sign(
27  gsl::span<const uint8_t> message, const EcdsaPrivateKey &key) const = 0;
28 
29  virtual outcome::result<EcdsaSignature> signPrehashed(
30  const EcdsaPrehashedMessage &message,
31  const EcdsaPrivateKey &key) const = 0;
32 
33  virtual outcome::result<bool> verify(
34  gsl::span<const uint8_t> message,
35  const EcdsaSignature &signature,
36  const EcdsaPublicKey &publicKey) const = 0;
37 
38  virtual outcome::result<bool> verifyPrehashed(
39  const EcdsaPrehashedMessage &message,
40  const EcdsaSignature &signature,
41  const EcdsaPublicKey &publicKey) const = 0;
42  };
43 } // namespace kagome::crypto
44 
45 #endif // KAGOME_CORE_CRYPTO_ECDSA_PROVIDER_HPP
std::vector< uint8_t > EcdsaSignature
Definition: ecdsa_types.hpp:43
virtual outcome::result< EcdsaSignature > sign(gsl::span< const uint8_t > message, const EcdsaPrivateKey &key) const =0
virtual outcome::result< EcdsaSignature > signPrehashed(const EcdsaPrehashedMessage &message, const EcdsaPrivateKey &key) const =0
libp2p::crypto::ecdsa::PrehashedMessage EcdsaPrehashedMessage
Definition: ecdsa_types.hpp:45
virtual outcome::result< EcdsaPublicKey > derive(const EcdsaSeed &seed) const =0
virtual outcome::result< bool > verify(gsl::span< const uint8_t > message, const EcdsaSignature &signature, const EcdsaPublicKey &publicKey) const =0
virtual ~EcdsaProvider()=default
virtual outcome::result< EcdsaKeypairAndSeed > generate() const =0
virtual outcome::result< bool > verifyPrehashed(const EcdsaPrehashedMessage &message, const EcdsaSignature &signature, const EcdsaPublicKey &publicKey) const =0