Kagome
Polkadot Runtime Engine in C++17
secp256k1_provider_impl.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CRYPTO_SECP256K1_PROVIDER_IMPL_HPP
7 #define KAGOME_CRYPTO_SECP256K1_PROVIDER_IMPL_HPP
8 
9 #include <secp256k1.h>
10 
12 
13 namespace kagome::crypto {
14 
16  INVALID_ARGUMENT = 1,
21  };
22 
24  public:
25  ~Secp256k1ProviderImpl() override = default;
26 
28 
29  outcome::result<secp256k1::UncompressedPublicKey>
30  recoverPublickeyUncompressed(
31  const secp256k1::RSVSignature &signature,
32  const secp256k1::MessageHash &message_hash) const override;
33 
34  outcome::result<secp256k1::CompressedPublicKey> recoverPublickeyCompressed(
35  const secp256k1::RSVSignature &signature,
36  const secp256k1::MessageHash &message_hash) const override;
37 
38  private:
39  outcome::result<secp256k1_pubkey> recoverPublickey(
40  const secp256k1::RSVSignature &signature,
41  const secp256k1::MessageHash &message_hash) const;
42 
43  std::unique_ptr<secp256k1_context, void (*)(secp256k1_context *)> context_;
44  };
45 } // namespace kagome::crypto
46 
48 
49 #endif // KAGOME_CRYPTO_SECP256K1_PROVIDER_IMPL_HPP
OUTCOME_HPP_DECLARE_ERROR(kagome::crypto, Secp256k1ProviderError)
std::unique_ptr< secp256k1_context, void(*)(secp256k1_context *)> context_