Skip to content

Commit

Permalink
Add privacy report warning in NBGL Use Case
Browse files Browse the repository at this point in the history
  • Loading branch information
nroggeman-ledger committed Jan 9, 2025
1 parent a2be76c commit e97173d
Show file tree
Hide file tree
Showing 9 changed files with 618 additions and 121 deletions.
Binary file added lib_nbgl/glyphs/32px/Privacy_32px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lib_nbgl/glyphs/40px/Important_Circle_40px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lib_nbgl/glyphs/40px/Privacy_40px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions lib_nbgl/include/nbgl_obj.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ extern "C" {
#define QRCODE_ICON C_QRCode_32px
#define MINI_PUSH_ICON C_Mini_Push_32px
#define WARNING_ICON C_Warning_32px
#define ROUND_WARN_ICON C_Important_Circle_32px
#define PRIVACY_ICON C_Privacy_32px
#else // TARGET_STAX
#define SPACE_ICON C_Space_40px
#define BACKSPACE_ICON C_Erase_40px
Expand All @@ -146,6 +148,8 @@ extern "C" {
#define QRCODE_ICON C_QRCode_40px
#define MINI_PUSH_ICON C_Mini_Push_40px
#define WARNING_ICON C_Warning_40px
#define ROUND_WARN_ICON C_Important_Circle_40px
#define PRIVACY_ICON C_Privacy_40px
#endif // TARGET_STAX

// For backward compatibility, to be remove later
Expand Down
90 changes: 89 additions & 1 deletion lib_nbgl/include/nbgl_use_case.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,86 @@ typedef struct {
};
} nbgl_tipBox_t;

/**
* @brief The different types of warning page contents
*
*/
typedef enum {
CENTERED_INFO_WARNING = 0, ///< Centered info
QRCODE_WARNING, ///< QR Code
BAR_LIST_WARNING ///< list of touchable bars, to display sub-pages
} nbgl_warningDetailsType_t;

/**
* @brief The necessary parameters to build a list of touchable bars, to display sub-pages
*
*/
typedef struct {
uint8_t nbBars; ///< number of touchable bars
const char *const *texts; ///< array of texts for each bar (nbBars items, in black/bold)
const char *const *subTexts; ///< array of texts for each bar (nbBars items, in black)
const nbgl_icon_details_t **icons; ///< array of icons for each bar (nbBars items)
const struct nbgl_warningDetails_s
*details; ///< array of nbBars structure giving what to deplay when each bar is touched.
} nbgl_warningBarList_t;

/**
* @brief The necessary parameters to build the page(s) displayed when the top-right button is
* touched in intro page (before review)
*
*/
typedef struct nbgl_warningDetails_s {
const char *title; ///< text of the page (used to go back)
nbgl_warningDetailsType_t
type; ///< type of content in the page, determining what to use in the following union
union {
nbgl_contentCenter_t
centeredInfo; ///< centered info, if type == @ref CENTERED_INFO_WARNING
#ifdef NBGL_QRCODE
nbgl_layoutQRCode_t qrCode; ///< QR code, if type == @ref QRCODE_WARNING
#endif // NBGL_QRCODE
nbgl_warningBarList_t barList; ///< touchable bars list, if type == @ref BAR_LIST_WARNING
};
} nbgl_warningDetails_t;

/**
* @brief The different types of pre-defined warnings
*
*/
typedef enum {
BLIND_SIGNING_WARN = 0, ///< Blind signing
W3C_ISSUE_WARN, ///< Web3 Checks issue
W3C_LOSING_SWAP_WARN, ///< Web3 Checks: Losing Swap risk
W3C_THREAT_DETECTED_WARN, ///< Web3 Checks: Thread detexted, malicious (know drainer)
NB_WARNING_TYPES
} nbgl_warningType_t;

/**
* @brief The necessary parameters to build a warning page preceding a review.
* One can either use `predefinedSet` when the warnings are already supported in @ref
* nbgl_warningType_t list, or use `introDetails` or `reviewDetails` to configure manually the
* warning pages
* @note it's also used to build the modal pages displayed when touching the top-right button in the
* review's first page
*
*/
typedef struct {
uint32_t predefinedSet; ///< bitfield of pre-defined warnings, to be taken in @ref
///< nbgl_warningType_t set it to 0 if not using pre-defined warnings
const nbgl_warningDetails_t
*introDetails; ///< details displayed when top-right button is touched in intro page
///< (before review) if using pre-defined configuration, set to NULL,
const nbgl_warningDetails_t
*reviewDetails; ///< details displayed when top-right button is touched in first/last page
///< of review if using pre-defined configuration, set to NULL
const nbgl_contentCenter_t
*info; ///< parameters to build the intro warning page, if not using pre-defined
const nbgl_icon_details_t
*introTopRightIcon; ///< icon to use in the intro warning page, if not using pre-defined
const nbgl_icon_details_t *reviewTopRightIcon; ///< icon to use in the first/last page of
///< review, if not using pre-defined
} nbgl_warning_t;

/**
* @brief The different types of operation to review
*
Expand Down Expand Up @@ -265,7 +345,15 @@ void nbgl_useCaseReviewBlindSigning(nbgl_operationType_t operationT
const char *finishTitle,
const nbgl_tipBox_t *tipBox,
nbgl_choiceCallback_t choiceCallback);

void nbgl_useCaseReviewWithWarning(nbgl_operationType_t operationType,
const nbgl_contentTagValueList_t *tagValueList,
const nbgl_icon_details_t *icon,
const char *reviewTitle,
const char *reviewSubTitle,
const char *finishTitle,
const nbgl_tipBox_t *tipBox,
const nbgl_warning_t *warning,
nbgl_choiceCallback_t choiceCallback);
void nbgl_useCaseAdvancedReview(nbgl_operationType_t operationType,
const nbgl_contentTagValueList_t *tagValueList,
const nbgl_icon_details_t *icon,
Expand Down
Loading

0 comments on commit e97173d

Please sign in to comment.