diff options
Diffstat (limited to 'src/device')
-rw-r--r-- | src/device/device_ledger.cpp | 23 | ||||
-rw-r--r-- | src/device/device_ledger.hpp | 2 |
2 files changed, 24 insertions, 1 deletions
diff --git a/src/device/device_ledger.cpp b/src/device/device_ledger.cpp index cc56de30c..c1256e926 100644 --- a/src/device/device_ledger.cpp +++ b/src/device/device_ledger.cpp @@ -197,9 +197,11 @@ namespace hw { #define INS_RESET 0x02 #define INS_GET_KEY 0x20 + #define INS_DISPLAY_ADDRESS 0x21 #define INS_PUT_KEY 0x22 #define INS_GET_CHACHA8_PREKEY 0x24 #define INS_VERIFY_KEY 0x26 + #define INS_MANAGE_SEEDWORDS 0x28 #define INS_SECRET_KEY_TO_PUBLIC_KEY 0x30 #define INS_GEN_KEY_DERIVATION 0x32 @@ -594,6 +596,27 @@ namespace hw { return true; } + void device_ledger::display_address(const cryptonote::subaddress_index& index, const boost::optional<crypto::hash8> &payment_id) { + AUTO_LOCK_CMD(); + + int offset = set_command_header_noopt(INS_DISPLAY_ADDRESS, payment_id?1:0); + //index + memmove(this->buffer_send+offset, &index, sizeof(cryptonote::subaddress_index)); + offset +=8 ; + + //payment ID + if (payment_id) { + memmove(this->buffer_send+offset, (*payment_id).data, 8); + } else { + memset(this->buffer_send+offset, 0, 8); + } + offset +=8; + + this->buffer_send[4] = offset-5; + this->length_send = offset; + CHECK_AND_ASSERT_THROW_MES(this->exchange_wait_on_input() == 0, "Timeout/Error on display address."); + } + /* ======================================================================= */ /* SUB ADDRESS */ /* ======================================================================= */ diff --git a/src/device/device_ledger.hpp b/src/device/device_ledger.hpp index c2caec3cf..05a26143a 100644 --- a/src/device/device_ledger.hpp +++ b/src/device/device_ledger.hpp @@ -199,7 +199,7 @@ namespace hw { bool get_public_address(cryptonote::account_public_address &pubkey) override; bool get_secret_keys(crypto::secret_key &viewkey , crypto::secret_key &spendkey) override; bool generate_chacha_key(const cryptonote::account_keys &keys, crypto::chacha_key &key, uint64_t kdf_rounds) override; - + void display_address(const cryptonote::subaddress_index& index, const boost::optional<crypto::hash8> &payment_id) override; /* ======================================================================= */ /* SUB ADDRESS */ |