Skip to content

Commit

Permalink
Update icons and some tests revision.
Browse files Browse the repository at this point in the history
  • Loading branch information
TeknoPT committed Dec 18, 2023
1 parent 17effac commit 9d29ec3
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ APP_SOURCE_PATH += src
ICON_NANOS = icons/nanos_app_phantasma.gif #16x16
ICON_NANOSP = icons/nanox_app_phantasma.gif #14x14
ICON_NANOX = icons/nanox_app_phantasma.gif #14x14
ICON_STAX = icons/stax_app_phantasma.png #32x32
ICON_STAX = icons/stax_app_phantasma.gif #32x32

# Application allowed derivation curves.
# Possibles curves are: secp256k1, secp256r1, ed25519 and bls12381g1
Expand Down
Binary file added icons/stax_app_phantasma.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed icons/stax_app_phantasma.png
Binary file not shown.
3 changes: 1 addition & 2 deletions tests/application_client/boilerplate_command_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,13 @@ def sign_tx(self, path: str, transaction: bytes) -> Generator[None, None, None]:
p2=P2.P2_MORE,
data=msg)
idx += 1

with self.backend.exchange_async(cla=CLA,
ins=InsType.SIGN_TX,
p1=idx,
p2=P2.P2_LAST,
data=messages[-1]) as response:
yield response
print ("sign_tx: ", response)

def get_async_response(self) -> Optional[RAPDU]:
return self.backend.last_async_response
3 changes: 0 additions & 3 deletions tests/application_client/boilerplate_response_unpacker.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,8 @@ def unpack_get_public_key_response(response: bytes) -> Tuple[int, bytes, int, by
reponse_str = base64.b16encode(response)
pub_key = reponse_str[0:64]
pub_key_len = len(pub_key)
#
#print(TAG, reponse_str[0:64])

response, chain_code_len, chain_code = pop_size_prefixed_buf_from_buf(response)
print(TAG, chain_code_len, chain_code)


assert pub_key_len == 64
Expand Down
41 changes: 22 additions & 19 deletions tests/test_sign_cmd.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from application_client.boilerplate_command_sender import BoilerplateCommandSender, Errors
from application_client.boilerplate_response_unpacker import unpack_get_public_key_response, unpack_sign_tx_response
from application_client.boilerplate_response_unpacker import unpack_sign_tx_response
from ragger.error import ExceptionRAPDU
from ragger.navigator import NavInsID
from utils import ROOT_SCREENSHOT_PATH, check_signature_validity
Expand All @@ -23,7 +23,7 @@ def test_sign_tx_short_tx(firmware, backend, navigator, test_name):
path: str = "m/44'/60'/0'/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)
rapdu = client.get_public_key(path=path)

keys = PhantasmaKeys.from_wif("L5UEVHBjujaR1721aZM5Zm5ayjDyamMZS9W35RE9Y9giRkdf3dVx")
amount = 10000000
Expand All @@ -43,30 +43,33 @@ def test_sign_tx_short_tx(firmware, backend, navigator, test_name):
# you)
"PHANTASMAROCKS" # PAYLOAD
)
txSerialized = Base16.decode_uint8_array(transaction.toString(False))

print(TAG, Base16.encode_uint8_array(txSerialized))
txSerialized = Base16.decode_uint8_array(transaction.toString(False))

# 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=txSerialized):
# Validate the on-screen request by performing the navigation appropriate for this device
print(firmware.device)
if firmware.device.startswith("nano"):
navigator.navigate_until_text_and_compare(NavInsID.RIGHT_CLICK,
[NavInsID.BOTH_CLICK],
"Approve",
ROOT_SCREENSHOT_PATH,
test_name)
[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
[NavInsID.USE_CASE_REVIEW_CONFIRM,
NavInsID.USE_CASE_STATUS_DISMISS],
"Hold to sign",
ROOT_SCREENSHOT_PATH,
test_name)
print(client.get_async_response())
response = client.get_async_response()
print(response)
# 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


assert False
#'''_, der_sig, _ = unpack_sign_tx_response(response)
#assert check_signature_validity(public_key, der_sig, transaction)'''

Expand Down

0 comments on commit 9d29ec3

Please sign in to comment.