Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
tlv_use_case_dynamic_descriptor.h
Go to the documentation of this file.
1/*****************************************************************************
2 * (c) 2025 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
19#include "tlv_library.h"
20#include "buffer.h"
21#include "tokens.h"
22
23/* TLV use-case API on top of the TLV library
24 *
25 * This SDK helper implements the following cross-application specification:
26 * https://ledgerhq.atlassian.net/wiki/spaces/TA/pages/5603262535/Token+Dynamic+Descriptor
27 *
28 * Please refer to the tlv_library.h file for documentation on how to write your own use-case if it
29 * does not follow the above specification.
30 *
31 * The goal of this TLV use case is to parse dynamic information about a token for clear signing
32 * purposes.
33 * The trusted information comes from the Ledger CAL and is forwarded by the Ledger Live.
34 */
35
36#define DER_SIGNATURE_MIN_SIZE 64 // Ed25519 size
37#define DER_SIGNATURE_MAX_SIZE 72 // ECDSA max size
38
39// Output of the use-case TLV parser
41 // Version of the serialization format. Forwarded to the use-case caller as it may be needed
42 // for TUID parsing.
43 uint8_t version;
44 // Coin Type as defined in SLIP-44
45 uint32_t coin_type;
46 // Magnitude of the token (number of decimals)
47 uint8_t magnitude;
48 // The TUID contains a sub-TLV payload containing application specific data of this token.
50 // 0 copy is inconvenient for strings because they are not '\0' terminated in the TLV reception
51 // format
54
66
@ TLV_DYNAMIC_DESCRIPTOR_MISSING_STRUCTURE_TAG
@ TLV_DYNAMIC_DESCRIPTOR_SIGNATURE_ERROR
@ TLV_DYNAMIC_DESCRIPTOR_PARSING_ERROR
@ TLV_DYNAMIC_DESCRIPTOR_WRONG_APPLICATION_NAME
@ TLV_DYNAMIC_DESCRIPTOR_WRONG_TYPE
@ TLV_DYNAMIC_DESCRIPTOR_UNKNOWN_VERSION
@ TLV_DYNAMIC_DESCRIPTOR_MISSING_TAG
enum tlv_dynamic_descriptor_status_e tlv_dynamic_descriptor_status_t
struct tlv_dynamic_descriptor_out_s tlv_dynamic_descriptor_out_t
tlv_dynamic_descriptor_status_t tlv_use_case_dynamic_descriptor(const buffer_t *payload, tlv_dynamic_descriptor_out_t *out)
Processes a TLV dynamic descriptor use case.
#define MAX_TICKER_SIZE
Definition tokens.h:4