mirror of
https://github.com/monero-project/monero.git
synced 2025-08-23 00:35:12 -04:00
device: enable to use multiple independent device wallets
- adds a new option `--hw-device-deriv-path` to the simple wallet. Enables to specify wallet derivation path / wallet code (path avoided so it can be misinterpreted as a file path). - devices can use different derivation mechanisms. Trezor uses standard SLIP-10 mechanism with fixed SLIP-44 prefix for Monero - Trezor: when empty, the default derivation mechanism is used with 44'/128'/0'. When entered the derivation path is 44'/128'/PATH. - Trezor: the path is always taken as elements are hardened (1<<31 bit turned on)
This commit is contained in:
parent
318cc78457
commit
d21dad70dd
6 changed files with 73 additions and 2 deletions
|
@ -71,6 +71,7 @@ namespace trezor {
|
|||
i_device_callback * m_callback;
|
||||
|
||||
std::string full_name;
|
||||
std::vector<unsigned int> m_wallet_deriv_path;
|
||||
|
||||
cryptonote::network_type network_type;
|
||||
|
||||
|
@ -81,6 +82,7 @@ namespace trezor {
|
|||
void require_connected();
|
||||
void call_ping_unsafe();
|
||||
void test_ping();
|
||||
void ensure_derivation_path() noexcept;
|
||||
|
||||
// Communication methods
|
||||
|
||||
|
@ -176,9 +178,13 @@ namespace trezor {
|
|||
msg->add_address_n(x);
|
||||
}
|
||||
} else {
|
||||
ensure_derivation_path();
|
||||
for (unsigned int i : DEFAULT_BIP44_PATH) {
|
||||
msg->add_address_n(i);
|
||||
}
|
||||
for (unsigned int i : m_wallet_deriv_path) {
|
||||
msg->add_address_n(i);
|
||||
}
|
||||
}
|
||||
|
||||
if (network_type){
|
||||
|
@ -201,7 +207,7 @@ namespace trezor {
|
|||
bool reset();
|
||||
|
||||
// Default derivation path for Monero
|
||||
static const uint32_t DEFAULT_BIP44_PATH[3];
|
||||
static const uint32_t DEFAULT_BIP44_PATH[2];
|
||||
|
||||
std::shared_ptr<Transport> getTransport(){
|
||||
return m_transport;
|
||||
|
@ -215,6 +221,8 @@ namespace trezor {
|
|||
return m_callback;
|
||||
}
|
||||
|
||||
void set_derivation_path(const std::string &deriv_path) override;
|
||||
|
||||
/* ======================================================================= */
|
||||
/* SETUP/TEARDOWN */
|
||||
/* ======================================================================= */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue