-
Notifications
You must be signed in to change notification settings - Fork 34
/
ecdsa_provider.hpp
45 lines (34 loc) · 1.38 KB
/
ecdsa_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
45
/**
* Copyright Quadrivium LLC
* All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "crypto/bip39/bip39_types.hpp"
#include "crypto/ecdsa_types.hpp"
namespace kagome::crypto {
class EcdsaProvider {
public:
using Keypair = EcdsaKeypair;
using PublicKey = EcdsaPublicKey;
using PrivateKey = EcdsaPrivateKey;
using Seed = EcdsaSeed;
using Junctions = std::span<const bip39::RawJunction>;
virtual ~EcdsaProvider() = default;
virtual outcome::result<EcdsaKeypair> generateKeypair(
const EcdsaSeed &seed, Junctions junctions) const = 0;
virtual outcome::result<EcdsaSignature> sign(
common::BufferView message, const EcdsaPrivateKey &key) const = 0;
virtual outcome::result<EcdsaSignature> signPrehashed(
const EcdsaPrehashedMessage &message,
const EcdsaPrivateKey &key) const = 0;
virtual outcome::result<bool> verify(common::BufferView message,
const EcdsaSignature &signature,
const EcdsaPublicKey &publicKey,
bool allow_overflow) const = 0;
virtual outcome::result<bool> verifyPrehashed(
const EcdsaPrehashedMessage &message,
const EcdsaSignature &signature,
const EcdsaPublicKey &publicKey) const = 0;
};
} // namespace kagome::crypto