fix(protobuf): add patch for ThpDeviceProperties.pairing_methods

This commit is contained in:
Szymon Lesisz
2025-11-20 13:45:48 +01:00
committed by Szymon Lesisz
parent a183f81662
commit 161406226b
4 changed files with 18 additions and 2 deletions

View File

@@ -129,6 +129,20 @@ export const events = (api: TrezorConnect) => {
//
}
}
if (event.type === 'ui-request_thp_pairing') {
if (event.payload.device.thp?.properties?.pairing_methods[0] === 'CodeEntry') {
api.uiResponse({
type: 'ui-receive_thp_pairing_tag',
payload: { selectedMethod: 1 },
});
api.uiResponse({
type: 'ui-receive_thp_pairing_tag',
payload: { source: 'code-entry', tag: '0000' },
});
}
}
});
api.off(UI_EVENT, () => {});

View File

@@ -272,6 +272,7 @@ export const TYPE_PATCH = {
'MoneroTransferDetails.out_key': 'Uint8Array',
'MoneroTransferDetails.tx_pub_key': 'Uint8Array',
'MoneroTransferDetails.additional_tx_pub_keys': 'Uint8Array',
'ThpDeviceProperties.pairing_methods': '(keyof typeof ThpPairingMethod)',
};
export const readPatch = (file: string) =>

View File

@@ -5,6 +5,7 @@
import type {
ThpCredentialResponse,
ThpDeviceProperties,
ThpPairingMethod,
ThpProtobufMessageType,
} from './protobufTypes';
@@ -66,7 +67,7 @@ export type ThpMessageType = ThpProtobufMessageType & {
};
export type ThpHandshakeCredentials = {
pairingMethods: ThpDeviceProperties['pairing_methods'];
pairingMethods: ThpPairingMethod[];
handshakeHash: Buffer;
handshakeCommitment: Buffer;
codeEntryChallenge: Buffer;

View File

@@ -12,7 +12,7 @@ export type ThpDeviceProperties = {
model_variant: number;
protocol_version_major: number;
protocol_version_minor: number;
pairing_methods: ThpPairingMethod[];
pairing_methods: (keyof typeof ThpPairingMethod)[];
};
export type ThpHandshakeCompletionReqNoisePayload = {