LCOV - code coverage report
Current view: top level - src - external_signer.h (source / functions) Hit Total Coverage
Test: fuzz_coverage.info Lines: 0 1 0.0 %
Date: 2023-09-26 12:08:55 Functions: 0 3 0.0 %

          Line data    Source code
       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 <common/system.h>
       9             : #include <univalue.h>
      10             : 
      11             : #include <string>
      12             : #include <vector>
      13             : 
      14             : struct PartiallySignedTransaction;
      15             : 
      16             : //! Enables interaction with an external signing device or service, such as
      17             : //! a hardware wallet. See doc/external-signer.md
      18           0 : class ExternalSigner
      19             : {
      20             : private:
      21             :     //! The command which handles interaction with the external signer.
      22             :     std::string m_command;
      23             : 
      24             :     //! Bitcoin mainnet, testnet, etc
      25             :     std::string m_chain;
      26             : 
      27             :     std::string NetworkArg() const;
      28             : 
      29             : public:
      30             :     //! @param[in] command      the command which handles interaction with the external signer
      31             :     //! @param[in] fingerprint  master key fingerprint of the signer
      32             :     //! @param[in] chain        "main", "test", "regtest" or "signet"
      33             :     //! @param[in] name         device name
      34             :     ExternalSigner(const std::string& command, const std::string chain, const std::string& fingerprint, const std::string name);
      35             : 
      36             :     //! Master key fingerprint of the signer
      37             :     std::string m_fingerprint;
      38             : 
      39             :     //! Name of signer
      40             :     std::string m_name;
      41             : 
      42             :     //! Obtain a list of signers. Calls `<command> enumerate`.
      43             :     //! @param[in]              command the command which handles interaction with the external signer
      44             :     //! @param[in,out] signers  vector to which new signers (with a unique master key fingerprint) are added
      45             :     //! @param chain            "main", "test", "regtest" or "signet"
      46             :     //! @returns success
      47             :     static bool Enumerate(const std::string& command, std::vector<ExternalSigner>& signers, const std::string chain);
      48             : 
      49             :     //! Display address on the device. Calls `<command> displayaddress --desc <descriptor>`.
      50             :     //! @param[in] descriptor Descriptor specifying which address to display.
      51             :     //!            Must include a public key or xpub, as well as key origin.
      52             :     UniValue DisplayAddress(const std::string& descriptor) const;
      53             : 
      54             :     //! Get receive and change Descriptor(s) from device for a given account.
      55             :     //! Calls `<command> getdescriptors --account <account>`
      56             :     //! @param[in] account  which BIP32 account to use (e.g. `m/44'/0'/account'`)
      57             :     //! @returns see doc/external-signer.md
      58             :     UniValue GetDescriptors(const int account);
      59             : 
      60             :     //! Sign PartiallySignedTransaction on the device.
      61             :     //! Calls `<command> signtransaction` and passes the PSBT via stdin.
      62             :     //! @param[in,out] psbt  PartiallySignedTransaction to be signed
      63             :     bool SignTransaction(PartiallySignedTransaction& psbt, std::string& error);
      64             : };
      65             : 
      66             : #endif // BITCOIN_EXTERNAL_SIGNER_H

Generated by: LCOV version 1.14