mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-18 10:32:02 +00:00
refactor u2f dialogs into a separate function
This commit is contained in:
parent
ad2bab0186
commit
041eaa5e4b
@ -335,3 +335,7 @@ void layoutSignIdentity(const IdentityType *identity, const char *challenge)
|
|||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void layoutU2FDialog(const char *verb, const char *appid) {
|
||||||
|
layoutDialog(DIALOG_ICON_QUESTION, "Cancel", verb, NULL, verb, "U2F security key?", "", appid, "", NULL);
|
||||||
|
}
|
||||||
|
@ -40,5 +40,6 @@ void layoutDecryptMessage(const uint8_t *msg, uint32_t len, const char *address)
|
|||||||
void layoutAddress(const char *address, const char *desc);
|
void layoutAddress(const char *address, const char *desc);
|
||||||
void layoutPublicKey(const uint8_t *pubkey);
|
void layoutPublicKey(const uint8_t *pubkey);
|
||||||
void layoutSignIdentity(const IdentityType *identity, const char *challenge);
|
void layoutSignIdentity(const IdentityType *identity, const char *challenge);
|
||||||
|
void layoutU2FDialog(const char *verb, const char *appid);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -568,9 +568,7 @@ void u2f_register(const APDU *a)
|
|||||||
// error: testof-user-presence is required
|
// error: testof-user-presence is required
|
||||||
send_u2f_error(U2F_SW_CONDITIONS_NOT_SATISFIED);
|
send_u2f_error(U2F_SW_CONDITIONS_NOT_SATISFIED);
|
||||||
buttonUpdate(); // Clear button state
|
buttonUpdate(); // Clear button state
|
||||||
layoutDialog(DIALOG_ICON_QUESTION, "Cancel", "Register",
|
layoutU2FDialog("Register", getReadableAppId(req->appId));
|
||||||
NULL, "Register U2F", "security key",
|
|
||||||
"", getReadableAppId(req->appId), "", NULL);
|
|
||||||
dialog_timeout = U2F_TIMEOUT;
|
dialog_timeout = U2F_TIMEOUT;
|
||||||
last_req_state = REG;
|
last_req_state = REG;
|
||||||
return;
|
return;
|
||||||
@ -701,9 +699,7 @@ void u2f_authenticate(const APDU *a)
|
|||||||
// error: testof-user-presence is required
|
// error: testof-user-presence is required
|
||||||
send_u2f_error(U2F_SW_CONDITIONS_NOT_SATISFIED);
|
send_u2f_error(U2F_SW_CONDITIONS_NOT_SATISFIED);
|
||||||
buttonUpdate(); // Clear button state
|
buttonUpdate(); // Clear button state
|
||||||
layoutDialog(DIALOG_ICON_QUESTION, "Cancel", "Authenticate", NULL,
|
layoutU2FDialog("Authenticate", getReadableAppId(req->appId));
|
||||||
"Authenticate U2F", "security key",
|
|
||||||
"", getReadableAppId(req->appId), "", NULL);
|
|
||||||
dialog_timeout = U2F_TIMEOUT;
|
dialog_timeout = U2F_TIMEOUT;
|
||||||
last_req_state = AUTH;
|
last_req_state = AUTH;
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user