diff --git a/tests/snapshots/nanos/test_sign_long_raw_msg/part0/00000.png b/tests/snapshots/nanos/test_sign_long_raw_msg/part0/00000.png new file mode 100644 index 0000000..c2420af Binary files /dev/null and b/tests/snapshots/nanos/test_sign_long_raw_msg/part0/00000.png differ diff --git a/tests/snapshots/nanos/test_sign_long_raw_msg/part0/00001.png b/tests/snapshots/nanos/test_sign_long_raw_msg/part0/00001.png new file mode 100644 index 0000000..71fb65e Binary files /dev/null and b/tests/snapshots/nanos/test_sign_long_raw_msg/part0/00001.png differ diff --git a/tests/snapshots/nanos/test_sign_long_raw_msg/part0/00002.png b/tests/snapshots/nanos/test_sign_long_raw_msg/part0/00002.png new file mode 100644 index 0000000..2d1b940 Binary files /dev/null and b/tests/snapshots/nanos/test_sign_long_raw_msg/part0/00002.png differ diff --git a/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00000.png b/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00000.png new file mode 100644 index 0000000..f06b65f Binary files /dev/null and b/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00000.png differ diff --git a/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00001.png b/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00001.png new file mode 100644 index 0000000..c68716a Binary files /dev/null and b/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00001.png differ diff --git a/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00002.png b/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00002.png new file mode 100644 index 0000000..03ca92b Binary files /dev/null and b/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00002.png differ diff --git a/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00003.png b/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00003.png new file mode 100644 index 0000000..ba6782f Binary files /dev/null and b/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00003.png differ diff --git a/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00004.png b/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00004.png new file mode 100644 index 0000000..88c45cd Binary files /dev/null and b/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00004.png differ diff --git a/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00005.png b/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00005.png new file mode 100644 index 0000000..c859023 Binary files /dev/null and b/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00005.png differ diff --git a/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00006.png b/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00006.png new file mode 100644 index 0000000..6dc8ceb Binary files /dev/null and b/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00006.png differ diff --git a/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00007.png b/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00007.png new file mode 100644 index 0000000..0cdb498 Binary files /dev/null and b/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00007.png differ diff --git a/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00008.png b/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00008.png new file mode 100644 index 0000000..66c411c Binary files /dev/null and b/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00008.png differ diff --git a/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00009.png b/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00009.png new file mode 100644 index 0000000..02d922b Binary files /dev/null and b/tests/snapshots/nanos/test_sign_long_raw_msg/part1/00009.png differ diff --git a/tests/snapshots/nanos/test_sign_short_raw_msg/00000.png b/tests/snapshots/nanos/test_sign_short_raw_msg/00000.png new file mode 100644 index 0000000..5caa4c0 Binary files /dev/null and b/tests/snapshots/nanos/test_sign_short_raw_msg/00000.png differ diff --git a/tests/snapshots/nanos/test_sign_short_raw_msg/00001.png b/tests/snapshots/nanos/test_sign_short_raw_msg/00001.png new file mode 100644 index 0000000..3efc0f6 Binary files /dev/null and b/tests/snapshots/nanos/test_sign_short_raw_msg/00001.png differ diff --git a/tests/snapshots/nanos/test_sign_short_raw_msg/00002.png b/tests/snapshots/nanos/test_sign_short_raw_msg/00002.png new file mode 100644 index 0000000..66c411c Binary files /dev/null and b/tests/snapshots/nanos/test_sign_short_raw_msg/00002.png differ diff --git a/tests/snapshots/nanos/test_sign_short_raw_msg/00003.png b/tests/snapshots/nanos/test_sign_short_raw_msg/00003.png new file mode 100644 index 0000000..02d922b Binary files /dev/null and b/tests/snapshots/nanos/test_sign_short_raw_msg/00003.png differ diff --git a/tests/snapshots/nanosp/test_sign_long_raw_msg/part0/00000.png b/tests/snapshots/nanosp/test_sign_long_raw_msg/part0/00000.png new file mode 100644 index 0000000..2d20155 Binary files /dev/null and b/tests/snapshots/nanosp/test_sign_long_raw_msg/part0/00000.png differ diff --git a/tests/snapshots/nanosp/test_sign_long_raw_msg/part0/00001.png b/tests/snapshots/nanosp/test_sign_long_raw_msg/part0/00001.png new file mode 100644 index 0000000..c4bbf90 Binary files /dev/null and b/tests/snapshots/nanosp/test_sign_long_raw_msg/part0/00001.png differ diff --git a/tests/snapshots/nanosp/test_sign_long_raw_msg/part1/00000.png b/tests/snapshots/nanosp/test_sign_long_raw_msg/part1/00000.png new file mode 100644 index 0000000..6644903 Binary files /dev/null and b/tests/snapshots/nanosp/test_sign_long_raw_msg/part1/00000.png differ diff --git a/tests/snapshots/nanosp/test_sign_long_raw_msg/part1/00001.png b/tests/snapshots/nanosp/test_sign_long_raw_msg/part1/00001.png new file mode 100644 index 0000000..8dc82b3 Binary files /dev/null and b/tests/snapshots/nanosp/test_sign_long_raw_msg/part1/00001.png differ diff --git a/tests/snapshots/nanosp/test_sign_long_raw_msg/part1/00002.png b/tests/snapshots/nanosp/test_sign_long_raw_msg/part1/00002.png new file mode 100644 index 0000000..35a288b Binary files /dev/null and b/tests/snapshots/nanosp/test_sign_long_raw_msg/part1/00002.png differ diff --git a/tests/snapshots/nanosp/test_sign_long_raw_msg/part1/00003.png b/tests/snapshots/nanosp/test_sign_long_raw_msg/part1/00003.png new file mode 100644 index 0000000..6d07ac6 Binary files /dev/null and b/tests/snapshots/nanosp/test_sign_long_raw_msg/part1/00003.png differ diff --git a/tests/snapshots/nanosp/test_sign_long_raw_msg/part1/00004.png b/tests/snapshots/nanosp/test_sign_long_raw_msg/part1/00004.png new file mode 100644 index 0000000..53ae651 Binary files /dev/null and b/tests/snapshots/nanosp/test_sign_long_raw_msg/part1/00004.png differ diff --git a/tests/snapshots/nanosp/test_sign_long_raw_msg/part1/00005.png b/tests/snapshots/nanosp/test_sign_long_raw_msg/part1/00005.png new file mode 100644 index 0000000..79857a0 Binary files /dev/null and b/tests/snapshots/nanosp/test_sign_long_raw_msg/part1/00005.png differ diff --git a/tests/snapshots/nanosp/test_sign_short_raw_msg/00000.png b/tests/snapshots/nanosp/test_sign_short_raw_msg/00000.png new file mode 100644 index 0000000..76560b8 Binary files /dev/null and b/tests/snapshots/nanosp/test_sign_short_raw_msg/00000.png differ diff --git a/tests/snapshots/nanosp/test_sign_short_raw_msg/00001.png b/tests/snapshots/nanosp/test_sign_short_raw_msg/00001.png new file mode 100644 index 0000000..29d2773 Binary files /dev/null and b/tests/snapshots/nanosp/test_sign_short_raw_msg/00001.png differ diff --git a/tests/snapshots/nanosp/test_sign_short_raw_msg/00002.png b/tests/snapshots/nanosp/test_sign_short_raw_msg/00002.png new file mode 100644 index 0000000..53ae651 Binary files /dev/null and b/tests/snapshots/nanosp/test_sign_short_raw_msg/00002.png differ diff --git a/tests/snapshots/nanosp/test_sign_short_raw_msg/00003.png b/tests/snapshots/nanosp/test_sign_short_raw_msg/00003.png new file mode 100644 index 0000000..79857a0 Binary files /dev/null and b/tests/snapshots/nanosp/test_sign_short_raw_msg/00003.png differ diff --git a/tests/snapshots/nanox/test_sign_long_raw_msg/part0/00000.png b/tests/snapshots/nanox/test_sign_long_raw_msg/part0/00000.png new file mode 100644 index 0000000..2d20155 Binary files /dev/null and b/tests/snapshots/nanox/test_sign_long_raw_msg/part0/00000.png differ diff --git a/tests/snapshots/nanox/test_sign_long_raw_msg/part0/00001.png b/tests/snapshots/nanox/test_sign_long_raw_msg/part0/00001.png new file mode 100644 index 0000000..c4bbf90 Binary files /dev/null and b/tests/snapshots/nanox/test_sign_long_raw_msg/part0/00001.png differ diff --git a/tests/snapshots/nanox/test_sign_long_raw_msg/part1/00000.png b/tests/snapshots/nanox/test_sign_long_raw_msg/part1/00000.png new file mode 100644 index 0000000..6644903 Binary files /dev/null and b/tests/snapshots/nanox/test_sign_long_raw_msg/part1/00000.png differ diff --git a/tests/snapshots/nanox/test_sign_long_raw_msg/part1/00001.png b/tests/snapshots/nanox/test_sign_long_raw_msg/part1/00001.png new file mode 100644 index 0000000..8dc82b3 Binary files /dev/null and b/tests/snapshots/nanox/test_sign_long_raw_msg/part1/00001.png differ diff --git a/tests/snapshots/nanox/test_sign_long_raw_msg/part1/00002.png b/tests/snapshots/nanox/test_sign_long_raw_msg/part1/00002.png new file mode 100644 index 0000000..35a288b Binary files /dev/null and b/tests/snapshots/nanox/test_sign_long_raw_msg/part1/00002.png differ diff --git a/tests/snapshots/nanox/test_sign_long_raw_msg/part1/00003.png b/tests/snapshots/nanox/test_sign_long_raw_msg/part1/00003.png new file mode 100644 index 0000000..6d07ac6 Binary files /dev/null and b/tests/snapshots/nanox/test_sign_long_raw_msg/part1/00003.png differ diff --git a/tests/snapshots/nanox/test_sign_long_raw_msg/part1/00004.png b/tests/snapshots/nanox/test_sign_long_raw_msg/part1/00004.png new file mode 100644 index 0000000..53ae651 Binary files /dev/null and b/tests/snapshots/nanox/test_sign_long_raw_msg/part1/00004.png differ diff --git a/tests/snapshots/nanox/test_sign_long_raw_msg/part1/00005.png b/tests/snapshots/nanox/test_sign_long_raw_msg/part1/00005.png new file mode 100644 index 0000000..79857a0 Binary files /dev/null and b/tests/snapshots/nanox/test_sign_long_raw_msg/part1/00005.png differ diff --git a/tests/snapshots/nanox/test_sign_short_raw_msg/00000.png b/tests/snapshots/nanox/test_sign_short_raw_msg/00000.png new file mode 100644 index 0000000..76560b8 Binary files /dev/null and b/tests/snapshots/nanox/test_sign_short_raw_msg/00000.png differ diff --git a/tests/snapshots/nanox/test_sign_short_raw_msg/00001.png b/tests/snapshots/nanox/test_sign_short_raw_msg/00001.png new file mode 100644 index 0000000..29d2773 Binary files /dev/null and b/tests/snapshots/nanox/test_sign_short_raw_msg/00001.png differ diff --git a/tests/snapshots/nanox/test_sign_short_raw_msg/00002.png b/tests/snapshots/nanox/test_sign_short_raw_msg/00002.png new file mode 100644 index 0000000..53ae651 Binary files /dev/null and b/tests/snapshots/nanox/test_sign_short_raw_msg/00002.png differ diff --git a/tests/snapshots/nanox/test_sign_short_raw_msg/00003.png b/tests/snapshots/nanox/test_sign_short_raw_msg/00003.png new file mode 100644 index 0000000..79857a0 Binary files /dev/null and b/tests/snapshots/nanox/test_sign_short_raw_msg/00003.png differ diff --git a/tests/snapshots/stax/test_sign_long_raw_msg/part0/00000.png b/tests/snapshots/stax/test_sign_long_raw_msg/part0/00000.png new file mode 100644 index 0000000..7edbd37 Binary files /dev/null and b/tests/snapshots/stax/test_sign_long_raw_msg/part0/00000.png differ diff --git a/tests/snapshots/stax/test_sign_long_raw_msg/part0/00001.png b/tests/snapshots/stax/test_sign_long_raw_msg/part0/00001.png new file mode 100644 index 0000000..279acd5 Binary files /dev/null and b/tests/snapshots/stax/test_sign_long_raw_msg/part0/00001.png differ diff --git a/tests/snapshots/stax/test_sign_long_raw_msg/part1/00000.png b/tests/snapshots/stax/test_sign_long_raw_msg/part1/00000.png new file mode 100644 index 0000000..8581a71 Binary files /dev/null and b/tests/snapshots/stax/test_sign_long_raw_msg/part1/00000.png differ diff --git a/tests/snapshots/stax/test_sign_long_raw_msg/part1/00001.png b/tests/snapshots/stax/test_sign_long_raw_msg/part1/00001.png new file mode 100644 index 0000000..aa60a57 Binary files /dev/null and b/tests/snapshots/stax/test_sign_long_raw_msg/part1/00001.png differ diff --git a/tests/snapshots/stax/test_sign_long_raw_msg/part1/00002.png b/tests/snapshots/stax/test_sign_long_raw_msg/part1/00002.png new file mode 100644 index 0000000..90a2294 Binary files /dev/null and b/tests/snapshots/stax/test_sign_long_raw_msg/part1/00002.png differ diff --git a/tests/snapshots/stax/test_sign_long_raw_msg/part1/00003.png b/tests/snapshots/stax/test_sign_long_raw_msg/part1/00003.png new file mode 100644 index 0000000..78bbaaf Binary files /dev/null and b/tests/snapshots/stax/test_sign_long_raw_msg/part1/00003.png differ diff --git a/tests/snapshots/stax/test_sign_long_raw_msg/part1/00004.png b/tests/snapshots/stax/test_sign_long_raw_msg/part1/00004.png new file mode 100644 index 0000000..c1a8fd4 Binary files /dev/null and b/tests/snapshots/stax/test_sign_long_raw_msg/part1/00004.png differ diff --git a/tests/snapshots/stax/test_sign_long_raw_msg/part1/00005.png b/tests/snapshots/stax/test_sign_long_raw_msg/part1/00005.png new file mode 100644 index 0000000..733caca Binary files /dev/null and b/tests/snapshots/stax/test_sign_long_raw_msg/part1/00005.png differ diff --git a/tests/snapshots/stax/test_sign_short_raw_msg/00000.png b/tests/snapshots/stax/test_sign_short_raw_msg/00000.png new file mode 100644 index 0000000..aa60a57 Binary files /dev/null and b/tests/snapshots/stax/test_sign_short_raw_msg/00000.png differ diff --git a/tests/snapshots/stax/test_sign_short_raw_msg/00001.png b/tests/snapshots/stax/test_sign_short_raw_msg/00001.png new file mode 100644 index 0000000..5b00255 Binary files /dev/null and b/tests/snapshots/stax/test_sign_short_raw_msg/00001.png differ diff --git a/tests/snapshots/stax/test_sign_short_raw_msg/00002.png b/tests/snapshots/stax/test_sign_short_raw_msg/00002.png new file mode 100644 index 0000000..78bbaaf Binary files /dev/null and b/tests/snapshots/stax/test_sign_short_raw_msg/00002.png differ diff --git a/tests/snapshots/stax/test_sign_short_raw_msg/00003.png b/tests/snapshots/stax/test_sign_short_raw_msg/00003.png new file mode 100644 index 0000000..c1a8fd4 Binary files /dev/null and b/tests/snapshots/stax/test_sign_short_raw_msg/00003.png differ diff --git a/tests/snapshots/stax/test_sign_short_raw_msg/00004.png b/tests/snapshots/stax/test_sign_short_raw_msg/00004.png new file mode 100644 index 0000000..733caca Binary files /dev/null and b/tests/snapshots/stax/test_sign_short_raw_msg/00004.png differ diff --git a/tests/test_sign_cmd.py b/tests/test_sign_cmd.py index 5b4fc9c..529b2a9 100644 --- a/tests/test_sign_cmd.py +++ b/tests/test_sign_cmd.py @@ -169,3 +169,90 @@ def test_sign_tx_short_msg(firmware, backend, navigator, test_name): response = client.get_async_response().data _, sig, _ = unpack_sign_tx_response(response) assert check_signature_validity(public_key, sig, message) + +# In this test we send to the device a message to sign and validate it on screen +# We will ensure that the displayed information is correct by using screenshots comparison +def test_sign_short_raw_msg(firmware, backend, navigator, test_name): + # Use the app interface instead of raw interface + client = AptosCommandSender(backend) + # The path used for this entire test + path: str = "m/44'/637'/1'/0'/0'" + + # First we need to get the public key of the device in order to build the transaction + rapdu = client.get_public_key(path=path) + _, public_key, _, _ = unpack_get_public_key_response(rapdu.data) + + # Create the mes that will be sent to the device for signing + message = bytes.fromhex("01020304ff") + + # Send the sign device instruction. + # As it requires on-screen validation, the function is asynchronous. + # It will yield the result when the navigation is done + with client.sign_tx(path=path, transaction=message): + # Validate the on-screen request by performing the navigation appropriate for this device + if firmware.device.startswith("nano"): + navigator.navigate_until_text_and_compare(NavInsID.RIGHT_CLICK, + [NavInsID.BOTH_CLICK], + "Approve", + ROOT_SCREENSHOT_PATH, + test_name) + else: + navigator.navigate_until_text_and_compare(NavInsID.USE_CASE_REVIEW_TAP, + [NavInsID.USE_CASE_REVIEW_CONFIRM, + NavInsID.USE_CASE_STATUS_DISMISS], + "Hold to sign", + ROOT_SCREENSHOT_PATH, + test_name) + + # The device as yielded the result, parse it and ensure that the signature is correct + response = client.get_async_response().data + _, sig, _ = unpack_sign_tx_response(response) + assert check_signature_validity(public_key, sig, message) + +# In this test we send to the device a message to sign and validate it on screen +# We will ensure that the displayed information is correct by using screenshots comparison +def test_sign_long_raw_msg(firmware, backend, navigator, test_name): + # Use the app interface instead of raw interface + client = AptosCommandSender(backend) + # The path used for this entire test + path: str = "m/44'/637'/1'/0'/0'" + + # First we need to get the public key of the device in order to build the transaction + rapdu = client.get_public_key(path=path) + _, public_key, _, _ = unpack_get_public_key_response(rapdu.data) + + # Create the mes that will be sent to the device for signing + message = bytes.fromhex("bc6f6693bddc1a9fec9e674a461eaa00b193094c6fc0d3b382a599c37e1aaa7618eff2c96a3586876082c4594c50c50d7dde1b0000000000000002190d44266241744264b964a37b8f09863167a12d3e70cda39376cfb4e3561e120a736372697074735f76320473776170030700000000000000000000000000000000000000000000000000000000000000010a6170746f735f636f696e094170746f73436f696e000743417434fd869edee76cca2a4d2301e528a1551b1d719b75c350c3c97d15b8b905636f696e7304555344540007190d44266241744264b964a37b8f09863167a12d3e70cda39376cfb4e3561e12066375727665730c556e636f7272656c6174656400020800e1f5050000000008decbb30000000000480000000000000064000000000000008a9ba4640000000002") + + with client.sign_tx(path=path, transaction=message): + if firmware.device.startswith("nano"): + navigator.navigate_until_text_and_compare(NavInsID.RIGHT_CLICK, + [NavInsID.BOTH_CLICK], + "Allow", + ROOT_SCREENSHOT_PATH, + test_name + "/part0", + screen_change_after_last_instruction=False) + navigator.navigate_until_text_and_compare(NavInsID.RIGHT_CLICK, + [NavInsID.BOTH_CLICK], + "Approve", + ROOT_SCREENSHOT_PATH, + test_name + "/part1") + else: + navigator.navigate_until_text_and_compare(NavInsID.USE_CASE_REVIEW_TAP, + [NavInsID.USE_CASE_CHOICE_CONFIRM, + NavInsID.USE_CASE_STATUS_DISMISS], + "Enable blind signing", + ROOT_SCREENSHOT_PATH, + test_name + "/part0", + screen_change_after_last_instruction=False) + navigator.navigate_until_text_and_compare(NavInsID.USE_CASE_REVIEW_TAP, + [NavInsID.USE_CASE_REVIEW_CONFIRM, + NavInsID.USE_CASE_STATUS_DISMISS], + "Hold to sign", + ROOT_SCREENSHOT_PATH, + test_name + "/part1") + + # The device as yielded the result, parse it and ensure that the signature is correct + response = client.get_async_response().data + _, sig, _ = unpack_sign_tx_response(response) + assert check_signature_validity(public_key, sig, message)