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
32#if defined(HAVE_ADDRESS_BOOK)
33
34/* Includes ------------------------------------------------------------------*/
35#include "os_types.h"
36#include "address_book.h"
37#include "bip32.h"
38
39/* Exported defines --------------------------------------------------------*/
40#define TYPE_REGISTER_IDENTITY 0x2d
41#define TYPE_EDIT_CONTACT_NAME 0x2e
42#define TYPE_EDIT_IDENTIFIER 0x31
43#define TYPE_EDIT_SCOPE 0x32
44#define TYPE_PROVIDE_CONTACT 0x33
45
46/* Exported defines (unconditional — plain numeric constants) ----------------*/
47#define GID_SIZE 32
48#define GROUP_HANDLE_SIZE 64
49
50#define CONTACT_NAME_LENGTH 33
51#define SCOPE_LENGTH 33
52#define IDENTIFIER_MAX_LENGTH 80
53
54/* Exported types, structures, unions ----------------------------------------*/
55
62typedef struct {
63 uint8_t gid[GID_SIZE];
64 char contact_name[CONTACT_NAME_LENGTH];
65 char scope[SCOPE_LENGTH];
66 uint8_t identifier[IDENTIFIER_MAX_LENGTH];
67 uint8_t identifier_len;
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} edit_contact_name_t;
89
96typedef struct {
97 identity_t identity;
98 char old_scope[SCOPE_LENGTH];
99} edit_scope_t;
100
101/* Exported functions prototypes --------------------------------------------- */
102bolos_err_t register_identity(uint8_t *buffer_in, size_t buffer_in_length);
103bolos_err_t edit_contact_name(uint8_t *buffer_in, size_t buffer_in_length);
104bolos_err_t edit_identifier(uint8_t *buffer_in, size_t buffer_in_length);
105bolos_err_t edit_scope(uint8_t *buffer_in, size_t buffer_in_length);
106bolos_err_t provide_contact(uint8_t *buffer_in, size_t buffer_in_length);
107
108#endif // HAVE_ADDRESS_BOOK
blockchain_family_e