-
Notifications
You must be signed in to change notification settings - Fork 34
/
secp256k1_provider.hpp
44 lines (37 loc) · 1.33 KB
/
secp256k1_provider.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* Copyright Quadrivium LLC
* All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "crypto/secp256k1_types.hpp"
#include "outcome/outcome.hpp"
namespace kagome::crypto {
/**
* @class Secp256k1Provider provides public key recovery functionality
*/
class Secp256k1Provider {
public:
virtual ~Secp256k1Provider() = default;
/**
* @brief recover public key in uncompressed form
* @param signature signature
* @param message_hash blake2s message hash
* @return uncompressed public key or error
*/
virtual outcome::result<secp256k1::UncompressedPublicKey>
recoverPublickeyUncompressed(const secp256k1::RSVSignature &signature,
const secp256k1::MessageHash &message_hash,
bool allow_overflow) const = 0;
/**
* @brief recover public key in compressed form
* @param signature signature
* @param message_hash blake2s message hash
* @return compressed public key or error
*/
virtual outcome::result<secp256k1::CompressedPublicKey>
recoverPublickeyCompressed(const secp256k1::RSVSignature &signature,
const secp256k1::MessageHash &message_hash,
bool allow_overflow) const = 0;
};
} // namespace kagome::crypto