Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
address_book_common.h
Go to the documentation of this file.
1/*****************************************************************************
2 * (c) 2026 Ledger SAS.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
17#ifndef ADDRESS_BOOK_COMMON_H
18#define ADDRESS_BOOK_COMMON_H
19
20#if defined(HAVE_ADDRESS_BOOK)
21
22#include <stdint.h>
23#include <stdbool.h>
24#include "tlv_library.h"
25#include "bip32.h"
26#include "lcx_sha256.h"
27#include "address_book.h"
28#include "identity.h"
29#include "ledger_account.h"
30#include "nbgl_use_case.h"
31
33
34bool address_book_handle_chain_id(const tlv_data_t *data, uint64_t *chain_id);
35
37
39 char *output_buffer,
40 size_t buffer_size);
41
43 const char *reviewTitle,
44 const char *confirmText,
45 nbgl_choiceCallback_t choiceCallback);
46
48
49void address_book_finalize_review(bool success,
50 const char *successMsg,
51 const char *errorMsg,
52 nbgl_callback_t finalize);
53
54// Persistent state for the Register Identity flow (lives through the NBGL callback).
55typedef struct {
58 uint8_t hmac_proof[CX_SHA256_SIZE];
59 uint8_t gid[GID_SIZE];
60 bool active;
62
63// Union of all mutually-exclusive per-command payload buffers.
64// Only one command is processed at a time, so a single allocation covers every flow.
74
75// Shared UI buffers: all flows use at most 3 tag/value pairs and one list.
80
82extern ab_ui_t g_ab_ui;
83
84#endif // HAVE_ADDRESS_BOOK
85
86#endif // ADDRESS_BOOK_COMMON_H
blockchain_family_e
ab_ui_t g_ab_ui
void address_book_finalize_review(bool success, const char *successMsg, const char *errorMsg, nbgl_callback_t finalize)
Common handling of a confirmed Address Book review's outcome.
void address_book_handle_review_rejected(nbgl_callback_t finalize)
Common handling of a rejected Address Book review.
bool address_book_handle_blockchain_family(const tlv_data_t *data, blockchain_family_e *family)
Generic handler for blockchain family.
bool address_book_handle_derivation_path(const tlv_data_t *data, path_bip32_t *bip32_path)
Generic handler for BIP32 derivation path.
ab_payload_u g_ab_payload
bool address_book_handle_printable_string(const tlv_data_t *data, char *output_buffer, size_t buffer_size)
Generic handler for printable string extraction.
bool address_book_handle_chain_id(const tlv_data_t *data, uint64_t *chain_id)
Generic handler for chain ID.
void address_book_display_review(const nbgl_icon_details_t *icon, const char *reviewTitle, const char *confirmText, nbgl_choiceCallback_t choiceCallback)
Display a confirmation review for an Address Book operation.
Register / Edit Contact Name / Edit Scope / Edit Identifier.
#define GID_SIZE
32-byte random group ID generated by the device
Definition identity.h:47
#define GROUP_HANDLE_SIZE
group_handle = gid(32) | MAC(K_group, gid)(32)
Definition identity.h:48
SHA-2 (Secure Hash Algorithm 2).
struct nbgl_contentTagValueList_s nbgl_contentTagValueList_t
This structure contains a list of [tag,value] pairs.
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.
void(* nbgl_callback_t)(void)
prototype of generic callback function
void(* nbgl_choiceCallback_t)(bool confirm)
prototype of choice callback function
nbgl_contentTagValueList_t list
nbgl_contentTagValue_t pairs[3]
Data extracted from an Edit Contact Name TLV payload.
Definition identity.h:84
Data extracted from an Edit Identifier TLV payload.
Definition identity.h:75
Data extracted from a Rename Ledger Account TLV payload.
Data extracted from an Edit Scope Name TLV payload.
Definition identity.h:96
Data extracted from a Register Identity TLV payload.
Definition identity.h:62
Data extracted from a Register Ledger Account TLV payload.
This structure contains a [tag,value] pair and possible extensions.
uint8_t gid[GID_SIZE]
uint8_t group_handle[GROUP_HANDLE_SIZE]
uint8_t hmac_proof[CX_SHA256_SIZE]
struct tlv_data_s tlv_data_t
edit_ledger_account_t edit_ledger_account
identity_t provide_contact
s_register_state_t reg
edit_scope_t edit_scope
edit_contact_name_t edit_contact_name
edit_identifier_t edit_identifier
ledger_account_t ledger_account