mirror of
https://github.com/monero-project/monero.git
synced 2025-08-06 03:44:20 -04:00
device/trezor: passphrase entry on host
- simple device callback object added. Device can request passphrase/PIN entry via the callback or notify user some action is required - callback is routed to wallet2, which routes the callback to i_wallet_callback so CLI or GUI wallets can support passphrase entry for HW tokens - wallet: device open needs wallet callback first - passphrase protected device needs wallet callback so user can enter passphrase
This commit is contained in:
parent
58ce16d4d9
commit
318cc78457
8 changed files with 134 additions and 22 deletions
|
@ -39,7 +39,7 @@ namespace trezor {
|
|||
|
||||
const uint32_t device_trezor_base::DEFAULT_BIP44_PATH[] = {0x8000002c, 0x80000080, 0x80000000};
|
||||
|
||||
device_trezor_base::device_trezor_base() {
|
||||
device_trezor_base::device_trezor_base(): m_callback(nullptr) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -332,10 +332,6 @@ namespace trezor {
|
|||
MDEBUG("on_passhprase_state_request");
|
||||
CHECK_AND_ASSERT_THROW_MES(msg, "Empty message");
|
||||
|
||||
if (m_callback){
|
||||
m_callback->on_passphrase_state_request(msg->state());
|
||||
}
|
||||
|
||||
messages::common::PassphraseStateAck m;
|
||||
resp = call_raw(&m);
|
||||
}
|
||||
|
|
|
@ -57,17 +57,6 @@ namespace trezor {
|
|||
#ifdef WITH_DEVICE_TREZOR
|
||||
class device_trezor_base;
|
||||
|
||||
/**
|
||||
* Trezor device callbacks
|
||||
*/
|
||||
class trezor_callback {
|
||||
public:
|
||||
virtual void on_button_request() {};
|
||||
virtual void on_pin_request(epee::wipeable_string & pin) {};
|
||||
virtual void on_passphrase_request(bool on_device, epee::wipeable_string & passphrase) {};
|
||||
virtual void on_passphrase_state_request(const std::string & state) {};
|
||||
};
|
||||
|
||||
/**
|
||||
* TREZOR device template with basic functions
|
||||
*/
|
||||
|
@ -79,7 +68,7 @@ namespace trezor {
|
|||
mutable boost::mutex command_locker;
|
||||
|
||||
std::shared_ptr<Transport> m_transport;
|
||||
std::shared_ptr<trezor_callback> m_callback;
|
||||
i_device_callback * m_callback;
|
||||
|
||||
std::string full_name;
|
||||
|
||||
|
@ -218,7 +207,11 @@ namespace trezor {
|
|||
return m_transport;
|
||||
}
|
||||
|
||||
std::shared_ptr<trezor_callback> getCallback(){
|
||||
void set_callback(i_device_callback * callback) override {
|
||||
m_callback = callback;
|
||||
}
|
||||
|
||||
i_device_callback * get_callback(){
|
||||
return m_callback;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue