mirror of
https://github.com/monero-project/monero.git
synced 2025-12-31 15:06:11 -08:00
device/trezor: trezor support added
This commit is contained in:
@@ -139,6 +139,15 @@ DISABLE_VS_WARNINGS(4244 4345)
|
||||
m_creation_timestamp = 0;
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
void account_base::deinit()
|
||||
{
|
||||
try{
|
||||
m_keys.get_device().disconnect();
|
||||
} catch (const std::exception &e){
|
||||
MERROR("Device disconnect exception: " << e.what());
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
void account_base::forget_spend_key()
|
||||
{
|
||||
m_keys.m_spend_secret_key = crypto::secret_key();
|
||||
@@ -206,11 +215,16 @@ DISABLE_VS_WARNINGS(4244 4345)
|
||||
void account_base::create_from_device(hw::device &hwdev)
|
||||
{
|
||||
m_keys.set_device(hwdev);
|
||||
MCDEBUG("ledger", "device type: "<<typeid(hwdev).name());
|
||||
hwdev.init();
|
||||
hwdev.connect();
|
||||
hwdev.get_public_address(m_keys.m_account_address);
|
||||
hwdev.get_secret_keys(m_keys.m_view_secret_key, m_keys.m_spend_secret_key);
|
||||
MCDEBUG("device", "device type: "<<typeid(hwdev).name());
|
||||
CHECK_AND_ASSERT_THROW_MES(hwdev.init(), "Device init failed");
|
||||
CHECK_AND_ASSERT_THROW_MES(hwdev.connect(), "Device connect failed");
|
||||
try {
|
||||
CHECK_AND_ASSERT_THROW_MES(hwdev.get_public_address(m_keys.m_account_address), "Cannot get a device address");
|
||||
CHECK_AND_ASSERT_THROW_MES(hwdev.get_secret_keys(m_keys.m_view_secret_key, m_keys.m_spend_secret_key), "Cannot get device secret");
|
||||
} catch (const std::exception &e){
|
||||
hwdev.disconnect();
|
||||
throw;
|
||||
}
|
||||
struct tm timestamp = {0};
|
||||
timestamp.tm_year = 2014 - 1900; // year 2014
|
||||
timestamp.tm_mon = 4 - 1; // month april
|
||||
|
||||
Reference in New Issue
Block a user