30 #ifndef MONERO_DEVICE_TREZOR_H 31 #define MONERO_DEVICE_TREZOR_H 36 #ifdef WITH_DEVICE_TREZOR 39 #include <boost/scope_exit.hpp> 40 #include <boost/thread/mutex.hpp> 41 #include <boost/thread/recursive_mutex.hpp> 55 #ifdef WITH_DEVICE_TREZOR 61 class device_trezor :
public hw::trezor::device_trezor_base,
public hw::device_cold {
63 std::atomic<bool> m_live_refresh_in_progress;
64 std::chrono::steady_clock::time_point m_last_live_refresh_time;
65 std::unique_ptr<boost::thread> m_live_refresh_thread;
66 std::atomic<bool> m_live_refresh_thread_running;
67 bool m_live_refresh_enabled;
68 size_t m_num_transations_to_sign;
70 unsigned client_version();
72 void transaction_pre_check(std::shared_ptr<messages::monero::MoneroTransactionInitRequest> init_msg);
73 void transaction_check(
const protocol::tx::TData & tdata,
const hw::tx_aux_data & aux_data);
74 void device_state_initialize_unsafe()
override;
75 void live_refresh_start_unsafe();
76 void live_refresh_finish_unsafe();
77 void live_refresh_thread_main();
86 std::shared_ptr<protocol::tx::Signer> & signer);
90 virtual ~device_trezor()
override;
92 device_trezor(
const device_trezor &
device) = delete ;
93 device_trezor& operator=(
const device_trezor &
device) =
delete;
95 explicit operator bool()
const override {
return true;}
99 bool disconnect()
override;
101 device_protocol_t device_protocol()
const override {
return PROTOCOL_COLD; };
103 bool has_ki_cold_sync()
const override {
return true; }
104 bool has_tx_cold_sign()
const override {
return true; }
106 void set_live_refresh_enabled(
bool enabled) { m_live_refresh_enabled = enabled; }
107 bool live_refresh_enabled()
const {
return m_live_refresh_enabled; }
123 std::shared_ptr<messages::monero::MoneroAddress>
get_address(
124 const boost::optional<cryptonote::subaddress_index> & subaddress = boost::none,
125 const boost::optional<crypto::hash8> & payment_id = boost::none,
126 bool show_address =
false,
127 const boost::optional<std::vector<uint32_t>> & path = boost::none,
128 const boost::optional<cryptonote::network_type> &
network_type = boost::none);
133 std::shared_ptr<messages::monero::MoneroWatchKey> get_view_key(
134 const boost::optional<std::vector<uint32_t>> & path = boost::none,
135 const boost::optional<cryptonote::network_type> &
network_type = boost::none);
140 bool is_get_tx_key_supported()
const override;
151 std::vector<::crypto::secret_key> & tx_keys,
152 const ::hw::device_cold::tx_key_data_t & tx_aux_data,
159 const std::vector<::tools::wallet2::transfer_details> & transfers,
162 bool is_live_refresh_supported()
const override;
164 bool is_live_refresh_enabled()
const;
166 bool has_ki_live_refresh()
const override;
168 void live_refresh_start()
override;
174 size_t real_output_index,
180 void live_refresh_finish()
override;
186 void computing_key_images(
bool started)
override;
192 bool compute_key_image(
193 const ::cryptonote::account_keys& ack,
196 size_t real_output_index,
197 const ::cryptonote::subaddress_index& received_index,
217 virtual void reset_session()
override;
222 bool seen_passphrase_entry_prompt()
override;
227 void set_use_empty_passphrase(
bool use_always_empty_passphrase)
override;
234 #endif //MONERO_DEVICE_TREZOR_H const char * res
Definition: hmac_keccak.cpp:42
static int init(int argc, char **argv, struct runtime_vars *v)
Definition: miniupnpd.c:1149
void register_all(std::map< std::string, std::unique_ptr< device >> ®istry)
Definition: device_trezor.cpp:776
def release
Definition: support.py:307
Definition: cryptonote_basic.h:538
::std::string string
Definition: gtest-port.h:1097
POD_CLASS key_derivation
Definition: crypto.h:88
epee::mlocked< tools::scrubbed< ec_scalar > > secret_key
Definition: crypto.h:72
Definition: minissdpd.c:75
tools::wallet2::unsigned_tx_set unsigned_tx_set
Definition: protocol.hpp:155
void load_tx_key_data(hw::device_cold::tx_key_data_t &res, const std::string &data)
Definition: protocol.cpp:1022
struct hw::wallet_shim wallet_shim
Definition: subaddress_index.h:38
Definition: device.cpp:38
cryptonote::account_public_address get_address(const var_addr_t &inp)
Definition: chaingen.cpp:817
POD_CLASS public_key
Definition: crypto.h:61
crypto::secret_key spendkey
Definition: cold-outputs.cpp:44
Definition: device_cold.hpp:44
network_type
Definition: cryptonote_config.h:301
Definition: cryptonote_basic.h:511
Definition: device_cold.hpp:53
POD_CLASS key_image
Definition: crypto.h:92
int bool
Definition: stdbool.h:35
std::shared_ptr< messages::monero::MoneroGetTxKeyRequest > get_tx_key(const hw::device_cold::tx_key_data_t &tx_data)
Definition: protocol.cpp:1053
Definition: device_cold.hpp:98
std::vector< std::pair< crypto::key_image, crypto::signature > > exported_key_image
Definition: device_cold.hpp:56