chore(protocol): export ThpPairingMethod as enum

This commit is contained in:
Szymon Lesisz
2025-11-27 19:44:42 +01:00
committed by Szymon Lesisz
parent 9408ea5e79
commit e61610e32b
4 changed files with 9 additions and 4 deletions

View File

@@ -44,3 +44,4 @@ export type {
} from '@trezor/blockchain-link';
export { FirmwareType, type VersionArray } from '@trezor/device-utils';
export { ThpPairingMethod } from '@trezor/protocol/src/protocol-thp/messages';

View File

@@ -15,5 +15,6 @@ export {
} from './crypto/pairing';
export { ThpState } from './ThpState';
export { getCurve25519KeyPair } from './crypto/curve25519';
export { getThpPairingMethod } from './utils';
export const name = 'thp';

View File

@@ -12,7 +12,7 @@ import {
THP_HANDSHAKE_INIT_RESPONSE,
THP_READ_ACK_HEADER_BYTE,
} from './constants';
import type { ThpMessageSyncBit } from './messages';
import { ThpMessageSyncBit, ThpPairingMethod } from './messages';
export const addAckBit = (magic: number, ackBit: number) => {
const result = Buffer.alloc(1);
@@ -154,3 +154,6 @@ export const isThpMessageName = (name: string) =>
'ThpHandshakeCompletionRequest',
'ThpReadAck',
].includes(name);
export const getThpPairingMethod = (dm: ThpPairingMethod | keyof typeof ThpPairingMethod) =>
typeof dm === 'string' ? ThpPairingMethod[dm] : dm;

View File

@@ -1,7 +1,7 @@
export type {
ThpDeviceProperties,
export {
ThpPairingMethod,
ThpCredentials,
type ThpDeviceProperties,
type ThpCredentials,
} from './protocol-thp/messages';
export type { ThpState, ThpStateSerialized, ThpChannelState } from './protocol-thp/ThpState';