19#include "os_helpers.h"
23#include "status_words.h"
29#if defined(HAVE_TX_CHECK)
32#define HOW_IT_WORKS_NB 3
52 uint8_t reply = enabled;
102 PRINTF(
"[TX CHECK] Not available in a swap\n");
106 PRINTF(
"[TX CHECK] Already opted in\n");
111 PRINTF(
"[TX CHECK] Opt-in requested while a flow is on screen\n");
119 =
"The result is displayed: Critical threat, potential risk or no threat.";
121 =
"Scan the QR Code on your Ledger device for details on any threat or risk.";
134 &QUESTION_CIRCLE_ICON,
135 "Enable\nTransaction Check?",
136 "Real-time warnings powered\nby 3rd service providers.",
137 "By enabling, you accept T&Cs: ledger.com/tx-check",
167#if defined(HAVE_TX_CHECK_APDU)
static int io_send_response_pointer(const uint8_t *ptr, size_t size, uint16_t sw)
struct PACKED__ nbgl_icon_details_s nbgl_icon_details_t
Represents all information about an icon.
API of the Advanced BOLOS Graphical Library, for typical application use-cases.
@ LEFT_CONTENT_WARNING
left-aligned title and icon/text rows (touch devices only)
struct nbgl_genericDetails_s nbgl_genericDetails_t
The necessary parameters to build the page(s) displayed when the top-right button is touched in intro...
void nbgl_useCaseAdvancedChoiceWithDetails(const nbgl_icon_details_t *centerIcon, const nbgl_icon_details_t *headerIcon, const char *title, const char *message, const char *subMessage, const char *confirmText, const char *cancelText, nbgl_warningDetails_t *details, nbgl_choiceCallback_t callback)
void nbgl_useCaseStatus(const char *message, bool isSuccess, nbgl_callback_t quitCallback)
Transaction Check: risk report from a security provider, displayed during the review.
@ TX_CHECK_SETTING_OPT_IN
The user has seen the opt-in screen.
@ TX_CHECK_SETTING_ENABLE
Transaction Check is enabled.
@ TX_CHECK_PENDING
Opt-in screen displayed, the choice comes later.
@ TX_CHECK_NOT_ALLOWED
Report bound to the review in progress, swap, or app busy.
@ TX_CHECK_SUCCESS
Descriptor stored, or opt-in already done.
void finalize_ui_tx_check_opt_in(bool response_expected)
Leave the opt-in flow.
bool handle_tx_check_get_setting(tx_check_setting_t setting)
Read a persistent Transaction Check setting.
bool handle_tx_check_is_idle(void)
Tell whether the app is idle, so that the opt-in screen can be displayed.
void handle_tx_check_set_setting(tx_check_setting_t setting, bool value)
Write a persistent Transaction Check setting.
Transaction Check functions shared between the SDK sources, not exposed to the apps.
static bool tx_check_in_swap(void)
Tell whether the app runs a swap started by the Exchange app.
WEAK void handle_tx_check_opt_in_response(bool enabled)
Default reply to an opt-in request on the app APDU: the 1-byte enable state.
static const nbgl_icon_details_t * s_how_it_works_icons[HOW_IT_WORKS_NB]
static void send_opt_in_reply(bool enabled)
Send the 1-byte enable state with SWO_SUCCESS.
static bool s_response_expected
static const char * s_how_it_works_texts[HOW_IT_WORKS_NB]
static tx_check_status_t start_opt_in(bool response_expected, bool sdk_reply)
Display the opt-in screen if allowed and not seen yet.
static void opt_in_choice_cb(bool enable)
Store the user choice, send the pending reply, then display the status.
static nbgl_genericDetails_t s_how_it_works
tx_check_status_t tx_check_opt_in_sdk_apdu(void)
Display the opt-in screen for the SDK APDU, replied by the SDK.
tx_check_status_t tx_check_opt_in(bool response_expected)
Display the opt-in screen, from the settings or for an app APDU.
static void finalize_opt_in(void)
Hand the end of the opt-in flow over to the app.