Bitcoin Core  22.99.0
P2P Digital Currency
external_signer.h
Go to the documentation of this file.
1 // Copyright (c) 2018-2021 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_EXTERNAL_SIGNER_H
6 #define BITCOIN_EXTERNAL_SIGNER_H
7 
8 #include <univalue.h>
9 #include <util/system.h>
10 
11 #include <string>
12 #include <vector>
13 
15 
19 {
20 private:
22  std::string m_command;
23 
25  std::string m_chain;
26 
27  const std::string NetworkArg() const;
28 
29 public:
34  ExternalSigner(const std::string& command, const std::string chain, const std::string& fingerprint, const std::string name);
35 
37  std::string m_fingerprint;
38 
40  std::string m_name;
41 
47  static bool Enumerate(const std::string& command, std::vector<ExternalSigner>& signers, const std::string chain);
48 
52  UniValue DisplayAddress(const std::string& descriptor) const;
53 
58  UniValue GetDescriptors(const int account);
59 
63  bool SignTransaction(PartiallySignedTransaction& psbt, std::string& error);
64 };
65 
66 #endif // BITCOIN_EXTERNAL_SIGNER_H
ExternalSigner::DisplayAddress
UniValue DisplayAddress(const std::string &descriptor) const
Display address on the device.
Definition: external_signer.cpp:61
ExternalSigner::m_chain
std::string m_chain
Bitcoin mainnet, testnet, etc.
Definition: external_signer.h:25
ExternalSigner::Enumerate
static bool Enumerate(const std::string &command, std::vector< ExternalSigner > &signers, const std::string chain)
Obtain a list of signers.
Definition: external_signer.cpp:23
UniValue
Definition: univalue.h:19
ExternalSigner::SignTransaction
bool SignTransaction(PartiallySignedTransaction &psbt, std::string &error)
Sign PartiallySignedTransaction on the device.
Definition: external_signer.cpp:71
ExternalSigner::GetDescriptors
UniValue GetDescriptors(const int account)
Get receive and change Descriptor(s) from device for a given account.
Definition: external_signer.cpp:66
univalue.h
ExternalSigner::ExternalSigner
ExternalSigner(const std::string &command, const std::string chain, const std::string &fingerprint, const std::string name)
Definition: external_signer.cpp:16
ExternalSigner
Enables interaction with an external signing device or service, such as a hardware wallet.
Definition: external_signer.h:18
name
const char * name
Definition: rest.cpp:43
system.h
PartiallySignedTransaction
A version of CTransaction with the PSBT format.
Definition: psbt.h:391
ExternalSigner::m_command
std::string m_command
The command which handles interaction with the external signer.
Definition: external_signer.h:22
ExternalSigner::NetworkArg
const std::string NetworkArg() const
Definition: external_signer.cpp:18
error
bool error(const char *fmt, const Args &... args)
Definition: system.h:49
ExternalSigner::m_fingerprint
std::string m_fingerprint
Master key fingerprint of the signer.
Definition: external_signer.h:37
ExternalSigner::m_name
std::string m_name
Name of signer.
Definition: external_signer.h:40