Skip to content

Commit

Permalink
[tmp] Tests porting
Browse files Browse the repository at this point in the history
  • Loading branch information
lpascal-ledger committed May 17, 2024
1 parent 9294895 commit 428442e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/ctap2_reset_flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void ctap2_reset_ux(void) {

io_seproxyhal_play_tune(TUNE_LOOK_AT_ME);

nbgl_useCaseChoice(&C_warning64px,
nbgl_useCaseChoice(&C_Warning_64px,
"Delete saved login\n"
"details for all\n"
"websites?\n",
Expand All @@ -91,4 +91,4 @@ void ctap2_reset_ux(void) {
ctap_ux_on_user_action);
}

#endif
#endif
8 changes: 4 additions & 4 deletions src/ui_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ static void settings_callback(int token, uint8_t index) {
if (config_get_rk_enabled()) {
config_set_rk_enabled(false);
} else {
nbgl_useCaseChoice(&C_warning64px,
nbgl_useCaseChoice(&C_Warning_64px,
"Enable resident keys?",
"Updating the OS or this app\n"
"will delete login info stored on\n"
Expand Down Expand Up @@ -403,7 +403,7 @@ void app_nbgl_status(const char *message,

nbgl_pageInfoDescription_t info = {.bottomButtonStyle = NO_BUTTON_STYLE,
.footerText = NULL,
.centeredInfo.icon = &C_round_cross_64px,
.centeredInfo.icon = &C_Denied_Circle_64px,
.centeredInfo.offsetY = 0,
.centeredInfo.onTop = false,
.centeredInfo.style = LARGE_CASE_INFO,
Expand All @@ -417,9 +417,9 @@ void app_nbgl_status(const char *message,
.tuneId = TUNE_TAP_CASUAL};

if (is_success) {
info.centeredInfo.icon = &C_round_check_64px;
info.centeredInfo.icon = &C_Check_Circle_64px;
} else {
info.centeredInfo.icon = &C_round_warning_64px;
info.centeredInfo.icon = &C_Important_Circle_64px;
}

pageContext = nbgl_pageDrawInfo(&onActionCallback, &ticker, &info);
Expand Down
8 changes: 4 additions & 4 deletions tests/speculos/ctap1_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ def __init__(self, device, model, navigator, debug=False):
self.debug = debug

def confirm(self):
if self.model == "stax":
if self.model in ["stax", "flex"]:
instructions = [NavInsID.USE_CASE_CHOICE_CONFIRM]
else:
instructions = [NavInsID.BOTH_CLICK]
self.navigator.navigate(instructions,
screen_change_after_last_instruction=False)

def wait_for_return_on_dashboard(self):
if self.model == "stax":
if self.model in ["stax", "flex"]:
# On Stax tap on the center to dismiss the status message faster
self.navigator.navigate([NavInsID.USE_CASE_STATUS_DISMISS])
self.navigator._backend.wait_for_home_screen()
Expand Down Expand Up @@ -108,7 +108,7 @@ def register(self, client_param, app_param, user_accept=True,
text = "Register"
else:
text = "Abort"
elif self.model == "stax":
elif self.model in ["stax", "flex"]:
if user_accept is not None:
if not user_accept:
val_ins = [NavInsID.USE_CASE_CHOICE_REJECT]
Expand Down Expand Up @@ -170,7 +170,7 @@ def authenticate(self, client_param, app_param, key_handle,
text = "Login"
else:
text = "Abort"
elif self.model == "stax":
elif self.model in ["stax", "flex"]:
if user_accept is not None:
if not user_accept:
val_ins = [NavInsID.USE_CASE_CHOICE_REJECT]
Expand Down
10 changes: 5 additions & 5 deletions tests/speculos/ctap2_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ def __init__(self, device, model, navigator, ctap2_u2f_proxy, debug=False):
super().__init__(device)

def confirm(self):
if self.model == "stax":
if self.model in ["stax", "flex"]:
instructions = [NavInsID.USE_CASE_CHOICE_CONFIRM]
else:
instructions = [NavInsID.BOTH_CLICK]
self.navigator.navigate(instructions,
screen_change_after_last_instruction=False)

def wait_for_return_on_dashboard(self):
if self.model == "stax":
if self.model in ["stax", "flex"]:
# On Stax tap on the center to dismiss the status message faster
# Ignore if there is nothing that happen (probably already on home screen),
# which is expected for flow without status (reset)
Expand Down Expand Up @@ -144,7 +144,7 @@ def make_credential(self, client_data_hash, rp, user, key_params,
text = "Don't register"
else:
text = "Register$"
elif self.model == "stax":
elif self.model in ["stax", "flex"]:
if user_accept is not None:
if not user_accept:
val_ins = [NavInsID.USE_CASE_CHOICE_REJECT]
Expand Down Expand Up @@ -224,7 +224,7 @@ def get_assertion(self, rp_id, client_data_hash, allow_list=None,
text = "Log in"
else:
text = "Reject"
elif self.model == "stax":
elif self.model in ["stax", "flex"]:
if user_accept is not None:
if login_type == "none":
val_ins = [NavInsID.TAPPABLE_CENTER_TAP]
Expand Down Expand Up @@ -282,7 +282,7 @@ def reset(self, *, event=None, on_keepalive=None, user_accept=True,
text = "Yes, delete"
else:
text = "No, don't delete"
elif self.model == "stax":
elif self.model in ["stax", "flex"]:
if user_accept is not None:
if not user_accept:
val_ins = [NavInsID.USE_CASE_CHOICE_REJECT]
Expand Down
4 changes: 4 additions & 0 deletions tests/speculos/fido2/test_get_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ def test_get_info_aaguid(client):
hs = sha256("Ledger FIDO 2 1.0 Stax".encode('utf-8')).hexdigest()
hs = hs[:32] # Keep only the 16 first bytes
assert hs == info.aaguid.hex()
elif client.model == "flex":
hs = sha256("Ledger FIDO 2 1.0 Flex".encode('utf-8')).hexdigest()
hs = hs[:32] # Keep only the 16 first bytes
assert hs == info.aaguid.hex()
else:
raise ValueError("Unhandled model")

Expand Down

0 comments on commit 428442e

Please sign in to comment.