Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
identity.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#pragma once
18
31#if defined(HAVE_ADDRESS_BOOK)
32
33/* Includes ------------------------------------------------------------------*/
34#include "os_types.h"
35#include "address_book.h"
36#include "bip32.h"
37
38/* Exported defines --------------------------------------------------------*/
39#define TYPE_REGISTER_IDENTITY 0x2d
40#define TYPE_EDIT_CONTACT_NAME 0x2e
41#define TYPE_EDIT_IDENTIFIER 0x31
42#define TYPE_EDIT_SCOPE 0x32
43#define TYPE_PROVIDE_CONTACT 0x33
44
45/* Exported defines (unconditional — plain numeric constants) ----------------*/
46#define GID_SIZE 32
47#define GROUP_HANDLE_SIZE 64
48
49#define CONTACT_NAME_LENGTH 33
50#define SCOPE_LENGTH 33
51#define IDENTIFIER_MAX_LENGTH 80
52
53/* Exported types, structures, unions ----------------------------------------*/
54
61typedef struct {
62 uint8_t gid[GID_SIZE];
63 char contact_name[CONTACT_NAME_LENGTH];
64 char scope[SCOPE_LENGTH];
65 uint8_t identifier[IDENTIFIER_MAX_LENGTH];
66 uint8_t identifier_len;
67 path_bip32_t bip32_path;
68 blockchain_family_e blockchain_family;
69 uint64_t chain_id;
70} identity_t;
71
75typedef struct {
76 identity_t identity;
77 uint8_t old_identifier[IDENTIFIER_MAX_LENGTH];
78 uint8_t old_identifier_len;
79} edit_identifier_t;
80
84typedef struct {
85 uint8_t gid[GID_SIZE];
86 char contact_name[CONTACT_NAME_LENGTH];
87 char old_contact_name[CONTACT_NAME_LENGTH];
88 path_bip32_t bip32_path;
89} edit_contact_name_t;
90
97typedef struct {
98 identity_t identity;
99 char old_scope[SCOPE_LENGTH];
100} edit_scope_t;
101
102/* Exported functions prototypes --------------------------------------------- */
103bolos_err_t register_identity(uint8_t *buffer_in, size_t buffer_in_length);
104bolos_err_t edit_contact_name(uint8_t *buffer_in, size_t buffer_in_length);
105bolos_err_t edit_identifier(uint8_t *buffer_in, size_t buffer_in_length);
106bolos_err_t edit_scope(uint8_t *buffer_in, size_t buffer_in_length);
107bolos_err_t provide_contact(uint8_t *buffer_in, size_t buffer_in_length);
108
109#endif // HAVE_ADDRESS_BOOK
blockchain_family_e