chore(protobuf): update THP protobuf messages

- rename *_static_pubkey > *_static_public_key
- added `ButtonAck` to thp.proto
This commit is contained in:
Szymon Lesisz
2025-07-21 13:50:20 +02:00
committed by martin
parent a77ec19007
commit 94267f36aa
6 changed files with 38 additions and 6 deletions

View File

@@ -2703,6 +2703,10 @@
"physical_button": {
"type": "DebugPhysicalButton",
"id": 8
},
"touch_event_type": {
"type": "DebugTouchEventType",
"id": 9
}
},
"nested": {
@@ -2727,6 +2731,13 @@
"MIDDLE_BTN": 1,
"RIGHT_BTN": 2
}
},
"DebugTouchEventType": {
"values": {
"TOUCH_FULL_CLICK": 0,
"TOUCH_START": 1,
"TOUCH_END": 2
}
}
}
},
@@ -3700,6 +3711,10 @@
"definitions": {
"type": "EthereumDefinitions",
"id": 4
},
"show_message_hash": {
"type": "bytes",
"id": 5
}
}
},

View File

@@ -52,7 +52,7 @@ const buildThpTypes = (json: ReturnType<typeof buildDefinitions>) => {
// MessageType is defined in common messages.proto file
const modifyMessageType = (proto: ReturnType<typeof buildDefinitions>) => {
const messageTypeEnum = proto.nested?.['MessageType'];
const messageTypeDuplicates = ['ButtonRequest', 'Cancel']; // exclude defined in both messages.proto and thp.proto
const messageTypeDuplicates = ['ButtonRequest', 'Cancel', 'ButtonAck']; // exclude defined in both messages.proto and thp.proto
const thpMessageTypeEnum = proto.nested?.['ThpMessageType'];
const thpMessageType = thpMessageTypeEnum?.values;
if (messageTypeEnum && thpMessageType) {

View File

@@ -1352,7 +1352,7 @@ export type CoinPurchaseMemo = Static<typeof CoinPurchaseMemo>;
export const CoinPurchaseMemo = Type.Object(
{
coin_type: Type.Number(),
amount: Type.String(),
amount: Type.Uint(),
address: Type.String(),
address_n: Type.Array(Type.Number()),
mac: Type.String(),
@@ -1484,6 +1484,15 @@ export enum DebugPhysicalButton {
export type EnumDebugPhysicalButton = Static<typeof EnumDebugPhysicalButton>;
export const EnumDebugPhysicalButton = Type.Enum(DebugPhysicalButton);
export enum DebugTouchEventType {
TOUCH_FULL_CLICK = 0,
TOUCH_START = 1,
TOUCH_END = 2,
}
export type EnumDebugTouchEventType = Static<typeof EnumDebugTouchEventType>;
export const EnumDebugTouchEventType = Type.Enum(DebugTouchEventType);
export enum DebugWaitType {
IMMEDIATE = 0,
NEXT_LAYOUT = 1,
@@ -1891,6 +1900,7 @@ export const EthereumSignTypedData = Type.Object(
primary_type: Type.String(),
metamask_v4_compat: Type.Optional(Type.Boolean()),
definitions: Type.Optional(EthereumDefinitions),
show_message_hash: Type.Optional(Type.String()),
},
{ $id: 'EthereumSignTypedData' },
);

View File

@@ -984,6 +984,12 @@ export enum DebugPhysicalButton {
RIGHT_BTN = 2,
}
export enum DebugTouchEventType {
TOUCH_FULL_CLICK = 0,
TOUCH_START = 1,
TOUCH_END = 2,
}
export enum DebugWaitType {
IMMEDIATE = 0,
NEXT_LAYOUT = 1,
@@ -1236,6 +1242,7 @@ export type EthereumSignTypedData = {
primary_type: string;
metamask_v4_compat?: boolean;
definitions?: EthereumDefinitions;
show_message_hash?: string;
};
export type EthereumTypedDataStructRequest = {

View File

@@ -50,14 +50,14 @@ export const getProtobufDefinitions = () => ({
ThpNfcTagTrezor: { fields: { tag: { rule: 'required', type: 'bytes', id: 1 } } },
ThpCredentialRequest: {
fields: {
host_static_pubkey: { rule: 'required', type: 'bytes', id: 1 },
host_static_public_key: { rule: 'required', type: 'bytes', id: 1 },
autoconnect: { type: 'bool', id: 2, options: { default: false } },
credential: { type: 'bytes', id: 3 },
},
},
ThpCredentialResponse: {
fields: {
trezor_static_pubkey: { rule: 'required', type: 'bytes', id: 1 },
trezor_static_public_key: { rule: 'required', type: 'bytes', id: 1 },
credential: { rule: 'required', type: 'bytes', id: 2 },
},
},

View File

@@ -76,13 +76,13 @@ export type ThpNfcTagTrezor = {
};
export type ThpCredentialRequest = {
host_static_pubkey: string;
host_static_public_key: string;
autoconnect: boolean;
credential?: string;
};
export type ThpCredentialResponse = {
trezor_static_pubkey: string;
trezor_static_public_key: string;
credential: string;
};