@onekeyfe/hd-core 1.2.0-alpha.44 → 1.2.0-alpha.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -81,6 +81,27 @@ const nftFileList = (count: number, basenameAt?: number) =>
81
81
  .join('\n');
82
82
 
83
83
  describe('DeviceUploadNft', () => {
84
+ test('defaults to maximum-size chunks without artificial pacing', () => {
85
+ const method = new DeviceUploadNft({
86
+ id: 1,
87
+ payload: {
88
+ method: 'deviceUploadNft',
89
+ image: { width: 540, height: 540, rgba: createRgba(540, 540) },
90
+ thumbnail: { width: 263, height: 263, rgba: createRgba(263, 263) },
91
+ title: 'CryptoPunk #3100',
92
+ subtitle: 'CryptoPunks',
93
+ timestampMs: 1_760_000_000_000,
94
+ },
95
+ });
96
+
97
+ method.init();
98
+
99
+ expect((method as any).params).toMatchObject({
100
+ chunkSize: 2048,
101
+ paceMs: 0,
102
+ });
103
+ });
104
+
84
105
  test('uploads the triplet in order without creating the firmware-owned directory', async () => {
85
106
  const typedCall = jest.fn((request: string, _response: string, params: any) => {
86
107
  if (request === 'FilesystemDirList') {
@@ -5,6 +5,7 @@ import GetPassphraseState from '../src/api/GetPassphraseState';
5
5
  import OpenWalletSession from '../src/api/OpenWalletSession';
6
6
  import { Device } from '../src/device/Device';
7
7
  import { deviceWalletSessionStore } from '../src/device/DeviceWalletSessionStore';
8
+ import { DEVICE } from '../src/events';
8
9
  import {
9
10
  ensureProtocolV2WalletSessionUnlocked,
10
11
  getProtocolV2WalletSession,
@@ -1130,7 +1131,28 @@ describe('openWalletSession', () => {
1130
1131
  payload: { method: 'openWalletSession', connectId: 'connect-id', mode: 'select-hidden' },
1131
1132
  });
1132
1133
  method.init();
1133
- method.device = createDevice({ typedCall, promptPassphrase }) as any;
1134
+ const device = createDevice({ typedCall, promptPassphrase });
1135
+ const passphraseInteraction = {
1136
+ interactionId: 'interaction-1',
1137
+ phaseId: 'interaction-1:phase-1',
1138
+ sequence: 1,
1139
+ phase: 'passphrase',
1140
+ transition: 'start',
1141
+ protocol: 'V2',
1142
+ } as const;
1143
+ const passphraseOnDeviceInteraction = {
1144
+ interactionId: 'interaction-1',
1145
+ phaseId: 'interaction-1:phase-2',
1146
+ sequence: 2,
1147
+ phase: 'passphrase-on-device',
1148
+ transition: 'start',
1149
+ protocol: 'V2',
1150
+ } as const;
1151
+ device.createProtocolV2UiPhaseMetadata = jest
1152
+ .fn()
1153
+ .mockReturnValueOnce(passphraseInteraction)
1154
+ .mockReturnValueOnce(passphraseOnDeviceInteraction);
1155
+ method.device = device as any;
1134
1156
 
1135
1157
  await expect(method.run()).resolves.toMatchObject({
1136
1158
  walletType: 'hidden',
@@ -1142,6 +1164,16 @@ describe('openWalletSession', () => {
1142
1164
  expect(typedCall).toHaveBeenNthCalledWith(3, 'DeviceSessionGet', 'DeviceSession', {
1143
1165
  seed_domains: [],
1144
1166
  });
1167
+ expect(device.createProtocolV2UiPhaseMetadata).toHaveBeenNthCalledWith(
1168
+ 2,
1169
+ 'passphrase-on-device',
1170
+ 'start'
1171
+ );
1172
+ expect(device.emit).toHaveBeenCalledWith(DEVICE.PASSPHRASE_ON_DEVICE, device, {
1173
+ source: 'wallet-session-coordinator',
1174
+ reason: 'open-wallet',
1175
+ interaction: passphraseOnDeviceInteraction,
1176
+ });
1145
1177
  });
1146
1178
 
1147
1179
  test('forwards a host passphrase to Pro2 firmware', async () => {
@@ -5797,16 +5797,10 @@ describe('Protocol V2 firmware reconnect identity', () => {
5797
5797
  ).not.toThrow();
5798
5798
  });
5799
5799
 
5800
- test('fails closed when the physical serial is unavailable', () => {
5801
- expect(() => assertProtocolV2ReconnectIdentity('expected-serial', undefined)).toThrow(
5802
- expect.objectContaining({ errorCode: HardwareErrorCode.DeviceNotFound })
5803
- );
5804
- expect(() => assertProtocolV2ReconnectIdentity(undefined, 'actual-serial')).toThrow(
5805
- expect.objectContaining({ errorCode: HardwareErrorCode.DeviceNotFound })
5806
- );
5807
- expect(() => assertProtocolV2ReconnectIdentity(undefined, undefined)).toThrow(
5808
- expect.objectContaining({ errorCode: HardwareErrorCode.DeviceNotFound })
5809
- );
5800
+ test('allows reconnect when either physical serial is unavailable', () => {
5801
+ expect(() => assertProtocolV2ReconnectIdentity('expected-serial', undefined)).not.toThrow();
5802
+ expect(() => assertProtocolV2ReconnectIdentity(undefined, 'actual-serial')).not.toThrow();
5803
+ expect(() => assertProtocolV2ReconnectIdentity(undefined, undefined)).not.toThrow();
5810
5804
  });
5811
5805
 
5812
5806
  test('captures physical identity from active DeviceInfo instead of wallet deviceId', async () => {
@@ -5839,7 +5833,7 @@ describe('Protocol V2 firmware reconnect identity', () => {
5839
5833
  );
5840
5834
  });
5841
5835
 
5842
- test('rejects firmware update startup when DeviceInfo has no physical serial', async () => {
5836
+ test('allows firmware update startup when DeviceInfo has no physical serial', async () => {
5843
5837
  const method = new FirmwareUpdateV4({
5844
5838
  id: 1,
5845
5839
  payload: { method: 'firmwareUpdateV4' },
@@ -5852,9 +5846,8 @@ describe('Protocol V2 firmware reconnect identity', () => {
5852
5846
  getCommands: () => ({ typedCall }),
5853
5847
  });
5854
5848
 
5855
- await expect((method as any).captureProtocolV2PhysicalIdentity()).rejects.toMatchObject({
5856
- errorCode: HardwareErrorCode.DeviceNotFound,
5857
- });
5849
+ await expect((method as any).captureProtocolV2PhysicalIdentity()).resolves.toBeUndefined();
5850
+ expect((method as any).protocolV2ExpectedSerialNumber).toBeUndefined();
5858
5851
  });
5859
5852
 
5860
5853
  test('uses ResourceInventory instead of host-side FileRead for resource comparison', async () => {
@@ -0,0 +1,86 @@
1
+ import { createDeferred } from '@onekeyfe/hd-shared';
2
+
3
+ import { findUiPromiseForResponse } from '../src/core/uiPromiseRegistry';
4
+ import { UI_RESPONSE } from '../src/events';
5
+
6
+ import type { UiPromise, UiPromiseResponse } from '../src/events';
7
+
8
+ const createPinPromise = (interactionId: string, deviceId: string) => {
9
+ const promise = createDeferred(UI_RESPONSE.RECEIVE_PIN) as UiPromise<
10
+ typeof UI_RESPONSE.RECEIVE_PIN
11
+ >;
12
+ promise.responseCorrelation = { interactionId, deviceId };
13
+ return promise;
14
+ };
15
+
16
+ const asRegistry = (promises: UiPromise<typeof UI_RESPONSE.RECEIVE_PIN>[]) =>
17
+ promises as UiPromise<UiPromiseResponse['type']>[];
18
+
19
+ describe('UI response promise correlation', () => {
20
+ test('matches a sensitive response by type, interactionId and deviceId', () => {
21
+ const deviceA = createPinPromise('interaction-a', 'device-a');
22
+ const deviceB = createPinPromise('interaction-b', 'device-b');
23
+
24
+ expect(
25
+ findUiPromiseForResponse(asRegistry([deviceA, deviceB]), {
26
+ type: UI_RESPONSE.RECEIVE_PIN,
27
+ payload: '123',
28
+ interactionId: 'interaction-b',
29
+ deviceId: 'device-b',
30
+ })
31
+ ).toBe(deviceB);
32
+ });
33
+
34
+ test('does not match incomplete or incorrect correlation metadata', () => {
35
+ const pending = createPinPromise('interaction-a', 'device-a');
36
+
37
+ expect(
38
+ findUiPromiseForResponse(asRegistry([pending]), {
39
+ type: UI_RESPONSE.RECEIVE_PIN,
40
+ payload: '123',
41
+ interactionId: 'interaction-a',
42
+ })
43
+ ).toBeUndefined();
44
+ expect(
45
+ findUiPromiseForResponse(asRegistry([pending]), {
46
+ type: UI_RESPONSE.RECEIVE_PIN,
47
+ payload: '123',
48
+ interactionId: 'interaction-a',
49
+ deviceId: 'device-b',
50
+ })
51
+ ).toBeUndefined();
52
+ });
53
+
54
+ test('keeps legacy responses only when the sensitive candidate is unique', () => {
55
+ const deviceA = createPinPromise('interaction-a', 'device-a');
56
+ const deviceB = createPinPromise('interaction-b', 'device-b');
57
+ const legacyResponse = {
58
+ type: UI_RESPONSE.RECEIVE_PIN,
59
+ payload: '123',
60
+ } as const;
61
+
62
+ expect(findUiPromiseForResponse(asRegistry([deviceA]), legacyResponse)).toBe(deviceA);
63
+ expect(
64
+ findUiPromiseForResponse(asRegistry([deviceA, deviceB]), legacyResponse)
65
+ ).toBeUndefined();
66
+ });
67
+
68
+ test('applies the same exact matching to passphrase responses', () => {
69
+ const promise = createDeferred(UI_RESPONSE.RECEIVE_PASSPHRASE) as UiPromise<
70
+ typeof UI_RESPONSE.RECEIVE_PASSPHRASE
71
+ >;
72
+ promise.responseCorrelation = {
73
+ interactionId: 'passphrase-interaction',
74
+ deviceId: 'device-a',
75
+ };
76
+
77
+ expect(
78
+ findUiPromiseForResponse([promise] as UiPromise<UiPromiseResponse['type']>[], {
79
+ type: UI_RESPONSE.RECEIVE_PASSPHRASE,
80
+ payload: { value: 'redacted' },
81
+ interactionId: 'passphrase-interaction',
82
+ deviceId: 'device-a',
83
+ })
84
+ ).toBe(promise);
85
+ });
86
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"FirmwareUpdateV4.d.ts","sourceRoot":"","sources":["../../src/api/FirmwareUpdateV4.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAkB/E,OAAO,KAAK,EAAE,sBAAsB,EAA0B,MAAM,6BAA6B,CAAC;AA+TlG,eAAO,MAAM,oCAAoC,WACvC,WAAW,GAAG,UAAU,eACnB,MAAM,GAAG,SAAS,YAKhC,CAAC;AAEF,eAAO,MAAM,iCAAiC,0BACrB,MAAM,uBACR,MAAM,SAc5B,CAAC;AAUF,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,wBAAwB,CAAC,sBAAsB,CAAC;IAC5F,OAAO,CAAC,8BAA8B,CAAC,CAAS;IAEhD,qBAAqB;IAIrB,IAAI;IA2DJ,OAAO,CAAC,8BAA8B;IAiBhC,GAAG;;;;;YAKK,aAAa;YAqEb,2BAA2B;IAWzC,OAAO,CAAC,yBAAyB;IAKjC,OAAO,CAAC,kCAAkC;YAO5B,iCAAiC;YAOjC,iCAAiC;YAOjC,iCAAiC;IAM/C,OAAO,CAAC,uBAAuB;IAI/B,OAAO,CAAC,4BAA4B;IAQpC,OAAO,CAAC,2BAA2B;IAsBnC,OAAO,CAAC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mD,MAAM,WAAW,CAAC;AAI9F,OAAO,KAAK,EACV,6BAA6B,EAG9B,MAAM,wBAAwB,CAAC;AAWhC,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;AA+D7D,eAAO,MAAM,OAAO,YAAmB,WAAW,WAAW,WAAW,iBAoFvE,CAAC;AAg2BF,eAAO,MAAM,MAAM,YAAa,WAAW,cAAc,MAAM,SAkF9D,CAAC;AA8FF,eAAO,MAAM,qBAAqB,gFAejC,CAAC;AAwKF,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,YAAY;IAC5C,OAAO,CAAC,cAAc,CAAoB;IAE1C,SAAgB,aAAa,EAAE,MAAM,CAAC;IAEtC,OAAO,CAAC,YAAY,CAAsB;IAE1C,OAAO,CAAC,cAAc,CAAC,CAAgB;IAGvC,OAAO,CAAC,qBAAqB,CAA4B;IAEzD,OAAO,CAAC,iBAAiB,CAAoB;;IAS7C,OAAO,CAAC,cAAc;IAoBhB,aAAa,CAAC,OAAO,EAAE,WAAW;IAuExC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;YAOV,gBAAgB;CAiC/B;AAED,eAAO,MAAM,QAAQ,YAIpB,CAAC;AAEF,eAAO,MAAM,aAAa,uBAYzB,CAAC;AAMF,eAAO,MAAM,IAAI,aACL,eAAe,aACd,GAAG,WACL,6BAA6B,8BAoBvC,CAAC;AAEF,eAAO,MAAM,eAAe;SAKrB,eAAe,CAAC,KAAK,CAAC;eAChB,GAAG;;UASf,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { UiPromise, UiPromiseResponse } from '../events/ui-promise';
2
+ import type { UiResponseEvent } from '../events/ui-response';
3
+ export declare const findUiPromiseForResponse: (uiPromises: UiPromise<UiPromiseResponse['type']>[], response: UiResponseEvent) => UiPromise<"ui-receive_pin" | "ui-receive_passphrase" | "ui-receive_select-device-in-bootloader-for-web-device" | "ui-receive_select-device-for-switch-firmware-web-device" | "device-disconnect"> | undefined;
4
+ //# sourceMappingURL=uiPromiseRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uiPromiseRegistry.d.ts","sourceRoot":"","sources":["../../src/core/uiPromiseRegistry.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAS7D,eAAO,MAAM,wBAAwB,eACvB,UAAU,iBAAiB,CAAC,MAAM,CAAC,CAAC,EAAE,YACxC,eAAe,kNA0B1B,CAAC"}
@@ -1,12 +1,14 @@
1
1
  import type { Deferred } from '@onekeyfe/hd-shared';
2
2
  import type { DEVICE } from './device';
3
3
  import type { Device } from '../device/Device';
4
- import type { UiResponseEvent } from './ui-response';
4
+ import type { UiResponseCorrelation, UiResponseEvent } from './ui-response';
5
5
  export type UiPromiseResponse = UiResponseEvent | {
6
6
  type: typeof DEVICE.DISCONNECT;
7
7
  payload?: undefined;
8
8
  };
9
9
  export type UiPromise<T extends UiPromiseResponse['type']> = Deferred<Extract<UiPromiseResponse, {
10
10
  type: T;
11
- }>, T, Device>;
11
+ }>, T, Device> & {
12
+ responseCorrelation?: UiResponseCorrelation;
13
+ };
12
14
  //# sourceMappingURL=ui-promise.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ui-promise.d.ts","sourceRoot":"","sources":["../../src/events/ui-promise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,MAAM,iBAAiB,GACzB,eAAe,GACf;IAAE,IAAI,EAAE,OAAO,MAAM,CAAC,UAAU,CAAC;IAAC,OAAO,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC;AAE5D,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,iBAAiB,CAAC,MAAM,CAAC,IAAI,QAAQ,CACnE,OAAO,CAAC,iBAAiB,EAAE;IAAE,IAAI,EAAE,CAAC,CAAA;CAAE,CAAC,EACvC,CAAC,EACD,MAAM,CACP,CAAC"}
1
+ {"version":3,"file":"ui-promise.d.ts","sourceRoot":"","sources":["../../src/events/ui-promise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAE5E,MAAM,MAAM,iBAAiB,GACzB,eAAe,GACf;IAAE,IAAI,EAAE,OAAO,MAAM,CAAC,UAAU,CAAC;IAAC,OAAO,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC;AAE5D,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,iBAAiB,CAAC,MAAM,CAAC,IAAI,QAAQ,CACnE,OAAO,CAAC,iBAAiB,EAAE;IAAE,IAAI,EAAE,CAAC,CAAA;CAAE,CAAC,EACvC,CAAC,EACD,MAAM,CACP,GAAG;IACF,mBAAmB,CAAC,EAAE,qBAAqB,CAAC;CAC7C,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import type { PROTO } from '../constants';
2
2
  import type { Device } from '../types';
3
3
  import type { DeviceButtonRequest } from './device';
4
+ import type { UiResponseCorrelation } from './ui-response';
4
5
  import type { MessageFactoryFn } from './utils';
5
6
  export declare const UI_EVENT = "UI_EVENT";
6
7
  export declare const UI_REQUEST: {
@@ -86,6 +87,7 @@ export type UiRequestDeviceAction = {
86
87
  payload: ProtocolV2UiEventMetadata & {
87
88
  device: Device;
88
89
  type?: PROTO.PinMatrixRequestType | 'ButtonRequest_PinEntry' | 'ButtonRequest_AttachPin';
90
+ responseCorrelation?: UiResponseCorrelation;
89
91
  };
90
92
  };
91
93
  export interface UiRequestButton {
@@ -103,6 +105,7 @@ export interface UiRequestPassphrase {
103
105
  reason?: 'open-wallet' | 'session-recovery';
104
106
  expectedPassphraseState?: string;
105
107
  interaction?: HardwareUiInteractionMeta;
108
+ responseCorrelation?: UiResponseCorrelation;
106
109
  };
107
110
  }
108
111
  export interface UiRequestPassphraseOnDevice {
@@ -1 +1 @@
1
- {"version":3,"file":"ui-request.d.ts","sourceRoot":"","sources":["../../src/events/ui-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,eAAO,MAAM,QAAQ,aAAa,CAAC;AAEnC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Cb,CAAC;AAEX,MAAM,MAAM,uBAAuB,GAC/B,oBAAoB,GACpB,4BAA4B,GAC5B,kBAAkB,CAAC;AAEvB,MAAM,MAAM,sBAAsB,GAAG,eAAe,GAAG,qBAAqB,CAAC;AAE7E,MAAM,MAAM,yBAAyB,GAAG;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,YAAY,GAAG,sBAAsB,GAAG,QAAQ,GAAG,YAAY,CAAC;IAC/E,UAAU,EAAE,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC5C,OAAO,CAAC,EAAE,WAAW,GAAG,WAAW,GAAG,QA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,wBAAwB,6BAA6B;IACrD,gBAAgB,qBAAqB;IACrC,uBAAuB,4BAA4B;CACpD;AAED,MAAM,MAAM,yBAAyB,GAAG,GAAG,wBAAwB,EAAE,CAAC;AAEtE,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG;IAAE,KAAK,EAAE,OAAO,QAAQ,CAAA;CAAE,CAAC;AAElE,eAAO,MAAM,eAAe,EAAE,gBAAgB,CAAC,OAAO,QAAQ,EAAE,OAAO,CAK5D,CAAC"}
@@ -6,11 +6,19 @@ export declare const UI_RESPONSE: {
6
6
  readonly SELECT_DEVICE_IN_BOOTLOADER_FOR_WEB_DEVICE: "ui-receive_select-device-in-bootloader-for-web-device";
7
7
  readonly SELECT_DEVICE_FOR_SWITCH_FIRMWARE_WEB_DEVICE: "ui-receive_select-device-for-switch-firmware-web-device";
8
8
  };
9
- export interface UiResponsePin {
9
+ export interface UiResponseCorrelation {
10
+ interactionId: string;
11
+ deviceId: string;
12
+ }
13
+ export interface UiResponseCorrelationFields {
14
+ interactionId?: string;
15
+ deviceId?: string;
16
+ }
17
+ export interface UiResponsePin extends UiResponseCorrelationFields {
10
18
  type: typeof UI_RESPONSE.RECEIVE_PIN;
11
19
  payload: string;
12
20
  }
13
- export interface UiResponsePassphrase {
21
+ export interface UiResponsePassphrase extends UiResponseCorrelationFields {
14
22
  type: typeof UI_RESPONSE.RECEIVE_PASSPHRASE;
15
23
  payload: {
16
24
  value: string;
@@ -1 +1 @@
1
- {"version":3,"file":"ui-response.d.ts","sourceRoot":"","sources":["../../src/events/ui-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,eAAO,MAAM,WAAW;;;;;CAOd,CAAC;AAEX,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,OAAO,WAAW,CAAC,WAAW,CAAC;IACrC,OAAO,EAAE,MAAM,CAAC;C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B;AAED,MAAM,WAAW,aAAc,SAAQ,2BAA2B;IAChE,IAAI,EAAE,OAAO,WAAW,CAAC,WAAW,CAAC;IACrC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,oBAAqB,SAAQ,2BAA2B;IACvE,IAAI,EAAE,OAAO,WAAW,CAAC,kBAAkB,CAAC;IAC5C,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAC7B,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;KAChB,CAAC;CACH;AAED,MAAM,WAAW,8CAA8C;IAC7D,IAAI,EAAE,OAAO,WAAW,CAAC,0CAA0C,CAAC;IACpE,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED,MAAM,WAAW,gDAAgD;IAC/D,IAAI,EAAE,OAAO,WAAW,CAAC,4CAA4C,CAAC;IACtE,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED,MAAM,MAAM,eAAe,GACvB,aAAa,GACb,oBAAoB,GACpB,8CAA8C,GAC9C,gDAAgD,CAAC;AAErD,MAAM,MAAM,iBAAiB,GAAG,eAAe,GAAG;IAAE,KAAK,EAAE,OAAO,QAAQ,CAAA;CAAE,CAAC;AAE7E,eAAO,MAAM,gBAAgB,EAAE,gBAAgB,CAAC,OAAO,QAAQ,EAAE,eAAe,CAQrE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -3884,6 +3884,51 @@ type DeviceEventMessage = DeviceEvent & {
3884
3884
  type DeviceEventListenerFn = (type: typeof DEVICE_EVENT, cb: (event: DeviceEventMessage) => void) => void;
3885
3885
  declare const createDeviceMessage: MessageFactoryFn<typeof DEVICE_EVENT, DeviceEvent>;
3886
3886
 
3887
+ declare const UI_RESPONSE: {
3888
+ readonly RECEIVE_PIN: "ui-receive_pin";
3889
+ readonly RECEIVE_PASSPHRASE: "ui-receive_passphrase";
3890
+ readonly SELECT_DEVICE_IN_BOOTLOADER_FOR_WEB_DEVICE: "ui-receive_select-device-in-bootloader-for-web-device";
3891
+ readonly SELECT_DEVICE_FOR_SWITCH_FIRMWARE_WEB_DEVICE: "ui-receive_select-device-for-switch-firmware-web-device";
3892
+ };
3893
+ interface UiResponseCorrelation {
3894
+ interactionId: string;
3895
+ deviceId: string;
3896
+ }
3897
+ interface UiResponseCorrelationFields {
3898
+ interactionId?: string;
3899
+ deviceId?: string;
3900
+ }
3901
+ interface UiResponsePin extends UiResponseCorrelationFields {
3902
+ type: typeof UI_RESPONSE.RECEIVE_PIN;
3903
+ payload: string;
3904
+ }
3905
+ interface UiResponsePassphrase extends UiResponseCorrelationFields {
3906
+ type: typeof UI_RESPONSE.RECEIVE_PASSPHRASE;
3907
+ payload: {
3908
+ value: string;
3909
+ passphraseOnDevice?: boolean;
3910
+ attachPinOnDevice?: boolean;
3911
+ save?: boolean;
3912
+ };
3913
+ }
3914
+ interface UiResponseSelectDeviceInBootloaderForWebDevice {
3915
+ type: typeof UI_RESPONSE.SELECT_DEVICE_IN_BOOTLOADER_FOR_WEB_DEVICE;
3916
+ payload: {
3917
+ deviceId: string;
3918
+ };
3919
+ }
3920
+ interface UiResponseSelectDeviceForSwitchFirmwareWebDevice {
3921
+ type: typeof UI_RESPONSE.SELECT_DEVICE_FOR_SWITCH_FIRMWARE_WEB_DEVICE;
3922
+ payload: {
3923
+ deviceId: string;
3924
+ };
3925
+ }
3926
+ type UiResponseEvent = UiResponsePin | UiResponsePassphrase | UiResponseSelectDeviceInBootloaderForWebDevice | UiResponseSelectDeviceForSwitchFirmwareWebDevice;
3927
+ type UiResponseMessage = UiResponseEvent & {
3928
+ event: typeof UI_EVENT;
3929
+ };
3930
+ declare const createUiResponse: MessageFactoryFn<typeof UI_EVENT, UiResponseEvent>;
3931
+
3887
3932
  declare const UI_EVENT = "UI_EVENT";
3888
3933
  declare const UI_REQUEST: {
3889
3934
  readonly REQUEST_PIN: "ui-request_pin";
@@ -3968,6 +4013,7 @@ type UiRequestDeviceAction = {
3968
4013
  payload: ProtocolV2UiEventMetadata & {
3969
4014
  device: Device$1;
3970
4015
  type?: Messages.PinMatrixRequestType | 'ButtonRequest_PinEntry' | 'ButtonRequest_AttachPin';
4016
+ responseCorrelation?: UiResponseCorrelation;
3971
4017
  };
3972
4018
  };
3973
4019
  interface UiRequestButton {
@@ -3985,6 +4031,7 @@ interface UiRequestPassphrase {
3985
4031
  reason?: 'open-wallet' | 'session-recovery';
3986
4032
  expectedPassphraseState?: string;
3987
4033
  interaction?: HardwareUiInteractionMeta;
4034
+ responseCorrelation?: UiResponseCorrelation;
3988
4035
  };
3989
4036
  }
3990
4037
  interface UiRequestPassphraseOnDevice {
@@ -4191,43 +4238,6 @@ interface MethodResponseMessage {
4191
4238
  declare const createResponseMessage: (id: number, success: boolean, payload: any) => MethodResponseMessage;
4192
4239
  type CallMethodKeys = keyof CoreApi;
4193
4240
 
4194
- declare const UI_RESPONSE: {
4195
- readonly RECEIVE_PIN: "ui-receive_pin";
4196
- readonly RECEIVE_PASSPHRASE: "ui-receive_passphrase";
4197
- readonly SELECT_DEVICE_IN_BOOTLOADER_FOR_WEB_DEVICE: "ui-receive_select-device-in-bootloader-for-web-device";
4198
- readonly SELECT_DEVICE_FOR_SWITCH_FIRMWARE_WEB_DEVICE: "ui-receive_select-device-for-switch-firmware-web-device";
4199
- };
4200
- interface UiResponsePin {
4201
- type: typeof UI_RESPONSE.RECEIVE_PIN;
4202
- payload: string;
4203
- }
4204
- interface UiResponsePassphrase {
4205
- type: typeof UI_RESPONSE.RECEIVE_PASSPHRASE;
4206
- payload: {
4207
- value: string;
4208
- passphraseOnDevice?: boolean;
4209
- attachPinOnDevice?: boolean;
4210
- save?: boolean;
4211
- };
4212
- }
4213
- interface UiResponseSelectDeviceInBootloaderForWebDevice {
4214
- type: typeof UI_RESPONSE.SELECT_DEVICE_IN_BOOTLOADER_FOR_WEB_DEVICE;
4215
- payload: {
4216
- deviceId: string;
4217
- };
4218
- }
4219
- interface UiResponseSelectDeviceForSwitchFirmwareWebDevice {
4220
- type: typeof UI_RESPONSE.SELECT_DEVICE_FOR_SWITCH_FIRMWARE_WEB_DEVICE;
4221
- payload: {
4222
- deviceId: string;
4223
- };
4224
- }
4225
- type UiResponseEvent = UiResponsePin | UiResponsePassphrase | UiResponseSelectDeviceInBootloaderForWebDevice | UiResponseSelectDeviceForSwitchFirmwareWebDevice;
4226
- type UiResponseMessage = UiResponseEvent & {
4227
- event: typeof UI_EVENT;
4228
- };
4229
- declare const createUiResponse: MessageFactoryFn<typeof UI_EVENT, UiResponseEvent>;
4230
-
4231
4241
  declare const LOG_EVENT = "LOG_EVENT";
4232
4242
  declare const LOG: {
4233
4243
  readonly OUTPUT: "log-output";
@@ -4303,7 +4313,9 @@ type UiPromiseResponse = UiResponseEvent | {
4303
4313
  };
4304
4314
  type UiPromise<T extends UiPromiseResponse['type']> = Deferred<Extract<UiPromiseResponse, {
4305
4315
  type: T;
4306
- }>, T, Device>;
4316
+ }>, T, Device> & {
4317
+ responseCorrelation?: UiResponseCorrelation;
4318
+ };
4307
4319
 
4308
4320
  declare const LogBlockEvent: Set<string>;
4309
4321
  declare function getLogBlockLabel(message: unknown): string | undefined;
@@ -4643,4 +4655,4 @@ declare const HardwareSdk: ({ init, call, dispose, eventEmitter, uiResponse, can
4643
4655
  declare const HardwareSDKLowLevel: ({ init, call, dispose, eventEmitter, addHardwareGlobalEventListener, uiResponse, cancel, updateSettings, switchTransport, }: LowLevelInjectApi) => LowLevelCoreApi;
4644
4656
  declare const HardwareTopLevelSdk: () => CoreApi;
4645
4657
 
4646
- export { AccountAddress, AccountAddresses, AlephiumAddress, AlephiumGetAddressParams, AlephiumSignMessageParams, AlephiumSignTransactionParams, AlephiumSignedTx, AlgoAddress, AlgoGetAddressParams, AlgoSignTransactionParams, AlgoSignedTx, AllFirmwareRelease, AllNetworkAddressParams, AllNetworkGetAddressParams, AptosAddress, AptosGetAddressParams, AptosGetPublicKeyParams, AptosMessageSignature, AptosPublicKey, AptosSignInMessageParams, AptosSignInMessageSignature, AptosSignMessageParams, AptosSignTransactionParams, AptosSignedTx, AssetsMap, BTCAddress, BTCGetAddressParams, BTCGetPublicKeyParams, BTCPublicKey, BTCSignMessageParams, BTCSignTransactionParams, BTCVerifyMessageParams, BenfenAddress, BenfenGetAddressParams, BenfenGetPublicKeyParams, BenfenPublicKey, BenfenSignMessageParams, BenfenSignTransactionParams, BenfenSignedTx, BleReleaseInfoEvent, BleReleaseInfoPayload, CORE_EVENT, CallMethod, CallMethodAnyResponse, CallMethodKeys, CallMethodPayload, CallMethodResponse, CallMethodUnion, CardanoAddress, CardanoGetAddressMethodParams, CardanoGetAddressParams, CardanoSignMessageMethodParams, CardanoSignMessageParams, CardanoSignTransaction, CardanoSignedTxData, CipheredKeyValue, CipheredKeyValueParams, ClearSessionCacheParams, ClearSessionCachePayload, CommonParams, ConfluxAddress, ConfluxGetAddressParams, ConfluxSignMessageCIP23Params, ConfluxSignMessageParams, ConfluxSignTransactionParams, ConfluxSignedTx, ConfluxTransaction, ConnectSettings, Core, CoreApi, CoreMessage, CosmosAddress, CosmosGetAddressParams, CosmosGetPublicKeyParams, CosmosPublicKey, CosmosSignTransactionParams, CosmosSignedTx, DEFAULT_PRIORITY, DEVICE, DEVICE_EVENT, DEVICE_SETTINGS_SHARED_FIELDS, DEVICE_SETTINGS_V1_ONLY_FIELDS, DEVICE_SETTINGS_V2_ONLY_FIELDS, DataManager, Device$1 as Device, DeviceButtonRequest, DeviceButtonRequestPayload, DeviceChangePinParams, DeviceConnnectRequest, DeviceDisconnnectRequest, DeviceEvent, DeviceEventListenerFn, DeviceEventMessage, DeviceFeaturesMode, DeviceFeaturesPayload, DeviceFeaturesProtocol, DeviceFeaturesRaw, DeviceFeaturesRawPatch, DeviceFeaturesVerify, DeviceFirmwareRange, DeviceFlagsParams, DeviceModelToTypes, DeviceProgress, DeviceRecoveryParams, DeviceResetParams, DeviceSendFeatures, DeviceSendState, DeviceSendSupportFeatures, DeviceSettingsCapabilities, DeviceSettingsDurationOption, DeviceSettingsField, DeviceSettingsParams, DeviceSettingsProtocol, DeviceSettingsValueOption, DeviceState, DeviceStateEvent, DeviceStateIdentity, DeviceStateMode, DeviceStatePatch, DeviceStateProtocol, DeviceStateScope, DeviceStateSection, DeviceStateSettings, DeviceStateStatus, DeviceStateUpdateSource, DeviceStateVersions, DeviceStatus, DeviceSupportFeatures, DeviceSupportFeaturesPayload, DeviceTypeMap, DeviceTypeToModels, DeviceUploadResourceParams, DeviceUploadResourceResponse, DeviceVerifyParams, DeviceVerifySignature, DnxAddress, DnxGetAddressParams, DnxSignTransactionParams, DnxSignature, DnxTxKey, EOneKeyDeviceMode, EVMAccessList, EVMAddress, EVMAuthorization, EVMAuthorizationSignature, EVMGetAddressParams, EVMGetPublicKeyParams, EVMPublicKey, EVMSignMessageEIP712Params, EVMSignMessageParams, EVMSignTransactionParams, EVMSignTypedDataParams, EVMSignedTx, EVMTransaction, EVMTransactionEIP1559, EVMTransactionEIP7702, EVMVerifyMessageParams, EthereumSignTypedDataMessage, EthereumSignTypedDataTypeProperty, EthereumSignTypedDataTypes, FIRMWARE, FIRMWARE_EVENT, Features, FilecoinAddress, FilecoinGetAddressParams, FilecoinSignTransactionParams, FilecoinSignedTx, FirmwareEvent, FirmwareMessage, FirmwareProcessing, FirmwareProgress, FirmwareRange, FirmwareRelease, FirmwareTip, FirmwareUpdateBinaryParams, FirmwareUpdateParams, FirmwareUpdateTipMessage, FirmwareUpdateV3Params, FirmwareUpdateV4Params, FirmwareUpdateV4Target, GetDeviceStateParams, GetPassphraseStateParams, HardwareSDKLowLevel, HardwareTopLevelSdk, HardwareUiInteractionMeta, IBLEFirmwareReleaseInfo, IDeviceBLEFirmwareStatus, IDeviceFirmwareStatus, IDeviceModel, IDeviceType, IFRAME, IFirmwareField, IFirmwareReleaseInfo, IFirmwareUpdateProgressType, IFirmwareUpdateTipMessage, IFrameBridge, IFrameCallMessage, IFrameCallback, IFrameCallbackMessage, IFrameCancelMessage, IFrameEvent, IFrameEventMessage, IFrameInit, IFrameSwitchTransport, IFrameSwitchTransportMessage, ILocale, IProtocolV2FirmwareComponent, IProtocolV2FirmwareComponentTarget, IProtocolV2Resource, IProtocolV2ResourceBundle, IProtocolV2ResourceType, IProtocolV2Resources, ITransportStatus, IVersionArray, IVersionRange, KaspaAddress, KaspaGetAddressParams, KaspaSignInputParams, KaspaSignOutputParams, KaspaSignTransactionParams, KaspaSignature, KaspaStreamingSignInputParams, KaspaStreamingSignOutputParams, KnownDevice, LOG, LOG_EVENT, LogBlockEvent, LogEvent, LogEventMessage, LogOutput, LoggerNames, LowLevelCoreApi, LowLevelInjectApi, MajorVersion, MethodResponseMessage, NEMAddress, NEMAggregateModificationTransaction, NEMGetAddressParams, NEMImportanceTransaction, NEMMosaic, NEMMosaicCreationTransaction, NEMMultisigTransaction, NEMProvisionNamespaceTransaction, NEMSignTransactionParams, NEMSupplyChangeTransaction, NEMTransaction, NEMTransferTransaction, NearAddress, NearGetAddressParams, NearSignTransactionParams, NervosAddress, NervosGetAddressParams, NervosSignTransactionParams, NervosSignedTx, NexaAddress, NexaGetAddressParams, NexaSignInputParams, NexaSignOutputParams, NexaSignTransactionParams, NexaSignature, NormalizedFeatures, OnekeyFeatures, OpenWalletSessionMode, OpenWalletSessionModeValue, OpenWalletSessionParams, OpenWalletSessionPayload, PRO2_WALLPAPER_HEIGHT, PRO2_WALLPAPER_WIDTH, PROTOCOL_V2_NEVER_TIMEOUT_MS, Params, PassphraseRequestPayload, PolkadotAddress, PolkadotGetAddressParams, PolkadotSignTransactionParams, PolkadotSignedTx, PostMessageEvent, PreviousAddressResult, Pro2WallpaperColorFormat, ProtocolV2FirmwareComponentRelease, ProtocolV2FirmwareComponentReleaseStatus, ProtocolV2FirmwareReleaseStatus, ProtocolV2UiCompletion, ProtocolV2UiEventMetadata, ProtocolV2UiEventSource, RESPONSE_EVENT, RefTransaction, ReleaseInfo, ReleaseInfoEvent, ReleaseInfoPayload, RemoteConfigResponse, RequestContext, Response, ScdoAddress, ScdoGetAddressParams, ScdoSignMessageParams, ScdoSignTransactionParams, ScdoSignedTx, SdkTracingContext, SearchDevice, SignedTransaction, SolSignMessageParams, SolSignMessageResponse, SolSignOffchainMessageParams, SolSignOffchainMessageResponse, SolanaAddress, SolanaGetAddressParams, SolanaSignTransactionParams, SolanaSignedTx, StarcoinAddress, StarcoinGetAddressParams, StarcoinGetPublicKeyParams, StarcoinPublicKey, StarcoinSignMessageParams, StarcoinSignTransactionParams, StarcoinVerifyMessageParams, StellarAddress, StellarAsset, StellarGetAddressParams, StellarOperation, StellarSignTransactionParams, StellarTransaction, StrictFeatures, Success, SuiAddress, SuiGetAddressParams, SuiGetPublicKeyParams, SuiPublicKey, SuiSignMessageParams, SuiSignTransactionParams, SuiSignedTx, SupportFeatureType, SupportFeatures, TestProtocolV2PingParams, TonAddress, TonGetAddressParams, TonSignDataParams, TonSignMessageParams, TonSignProofParams, TopLevelInjectApi, TransactionOptions, TransportReleaseStatus, TronAddress, TronDelegateResourceContract, TronFreezeBalanceV2Contract, TronGetAddressParams, TronSignMessageParams, TronSignTransactionParams, TronTransaction, TronTransactionContract, TronTransferContract, TronTriggerSmartContract, TronUnDelegateResourceContract, TronUnfreezeBalanceV2Contract, TronWithdrawBalanceContract, TronWithdrawExpireUnfreezeContract, UI_EVENT, UI_REQUEST, UI_RESPONSE, UiEvent, UiEventMessage, UiPromise, UiPromiseResponse, UiRequestButton, UiRequestDeviceAction, UiRequestFirmwareProgressing, UiRequestPassphrase, UiRequestPassphraseOnDevice, UiRequestSelectDeviceForSwitchFirmwareWebDevice, UiRequestSelectDeviceInBootloaderForWebDevice, UiRequestWindowClose, UiRequestWithoutPayload, UiResponseEvent, UiResponseMessage, UiResponsePassphrase, UiResponsePin, UiResponseSelectDeviceForSwitchFirmwareWebDevice, UiResponseSelectDeviceInBootloaderForWebDevice, UnavailableCapabilities, UnavailableCapability, Unsuccessful, VersionArray, checkNeedUpdateBootForClassicAndMini, checkNeedUpdateBootForTouch, cleanupCallback, cleanupSdkInstance, completeRequestContext, corsValidator, createDeviceMessage, createErrorMessage, createFirmwareMessage, createIFrameMessage, createLogMessage, createRequestContext, createResponseMessage, createSdkTracingContext, createUiMessage, createUiResponse, HardwareSdk as default, enableLog, encodePro2Wallpaper, executeCallback, formatLogMethodLabel, formatRequestContext, generateInstanceId, generateSdkInstanceId, getActiveRequestsByDeviceInstance, getAutoLockOptions, getAutoShutDownOptions, getDeviceBLEFirmwareVersion, getDeviceBleName, getDeviceBoardloaderVersion, getDeviceBootloaderVersion, getDeviceFirmwareVersion, getDeviceLabel, getDeviceSerialNo, getDeviceSettingsCapabilities, getDeviceType, getDeviceTypeByBleName, getDeviceUUID, getEnv, getFirmwareType, getFirmwareUpdateField, getFirmwareUpdateFieldArray, getHDPath, getHomeScreenDefaultList, getHomeScreenHex, getHomeScreenSize, getLanguageConfig, getLog, getLogBlockLabel, getLogger, getMethodVersionRange, getNftSize, getOutputScriptType, getSDKVersion, getSafeLogPayload, getScriptType, getTimeStamp, httpRequest, init$1 as initCore, isBleConnect, isValidVersionArray, isValidVersionString, normalizeSafetyCheckLevel, normalizeVersionArray, parseConnectSettings, parseMessage, patchFeatures, preloadSessionCache, safeThrowError, setLoggerPostMessage, supportInputPinOnSoftware, switchTransport, transportEnv, updateRequestContext, versionCompare, versionSplit, wait, whitelist, whitelistExtension };
4658
+ export { AccountAddress, AccountAddresses, AlephiumAddress, AlephiumGetAddressParams, AlephiumSignMessageParams, AlephiumSignTransactionParams, AlephiumSignedTx, AlgoAddress, AlgoGetAddressParams, AlgoSignTransactionParams, AlgoSignedTx, AllFirmwareRelease, AllNetworkAddressParams, AllNetworkGetAddressParams, AptosAddress, AptosGetAddressParams, AptosGetPublicKeyParams, AptosMessageSignature, AptosPublicKey, AptosSignInMessageParams, AptosSignInMessageSignature, AptosSignMessageParams, AptosSignTransactionParams, AptosSignedTx, AssetsMap, BTCAddress, BTCGetAddressParams, BTCGetPublicKeyParams, BTCPublicKey, BTCSignMessageParams, BTCSignTransactionParams, BTCVerifyMessageParams, BenfenAddress, BenfenGetAddressParams, BenfenGetPublicKeyParams, BenfenPublicKey, BenfenSignMessageParams, BenfenSignTransactionParams, BenfenSignedTx, BleReleaseInfoEvent, BleReleaseInfoPayload, CORE_EVENT, CallMethod, CallMethodAnyResponse, CallMethodKeys, CallMethodPayload, CallMethodResponse, CallMethodUnion, CardanoAddress, CardanoGetAddressMethodParams, CardanoGetAddressParams, CardanoSignMessageMethodParams, CardanoSignMessageParams, CardanoSignTransaction, CardanoSignedTxData, CipheredKeyValue, CipheredKeyValueParams, ClearSessionCacheParams, ClearSessionCachePayload, CommonParams, ConfluxAddress, ConfluxGetAddressParams, ConfluxSignMessageCIP23Params, ConfluxSignMessageParams, ConfluxSignTransactionParams, ConfluxSignedTx, ConfluxTransaction, ConnectSettings, Core, CoreApi, CoreMessage, CosmosAddress, CosmosGetAddressParams, CosmosGetPublicKeyParams, CosmosPublicKey, CosmosSignTransactionParams, CosmosSignedTx, DEFAULT_PRIORITY, DEVICE, DEVICE_EVENT, DEVICE_SETTINGS_SHARED_FIELDS, DEVICE_SETTINGS_V1_ONLY_FIELDS, DEVICE_SETTINGS_V2_ONLY_FIELDS, DataManager, Device$1 as Device, DeviceButtonRequest, DeviceButtonRequestPayload, DeviceChangePinParams, DeviceConnnectRequest, DeviceDisconnnectRequest, DeviceEvent, DeviceEventListenerFn, DeviceEventMessage, DeviceFeaturesMode, DeviceFeaturesPayload, DeviceFeaturesProtocol, DeviceFeaturesRaw, DeviceFeaturesRawPatch, DeviceFeaturesVerify, DeviceFirmwareRange, DeviceFlagsParams, DeviceModelToTypes, DeviceProgress, DeviceRecoveryParams, DeviceResetParams, DeviceSendFeatures, DeviceSendState, DeviceSendSupportFeatures, DeviceSettingsCapabilities, DeviceSettingsDurationOption, DeviceSettingsField, DeviceSettingsParams, DeviceSettingsProtocol, DeviceSettingsValueOption, DeviceState, DeviceStateEvent, DeviceStateIdentity, DeviceStateMode, DeviceStatePatch, DeviceStateProtocol, DeviceStateScope, DeviceStateSection, DeviceStateSettings, DeviceStateStatus, DeviceStateUpdateSource, DeviceStateVersions, DeviceStatus, DeviceSupportFeatures, DeviceSupportFeaturesPayload, DeviceTypeMap, DeviceTypeToModels, DeviceUploadResourceParams, DeviceUploadResourceResponse, DeviceVerifyParams, DeviceVerifySignature, DnxAddress, DnxGetAddressParams, DnxSignTransactionParams, DnxSignature, DnxTxKey, EOneKeyDeviceMode, EVMAccessList, EVMAddress, EVMAuthorization, EVMAuthorizationSignature, EVMGetAddressParams, EVMGetPublicKeyParams, EVMPublicKey, EVMSignMessageEIP712Params, EVMSignMessageParams, EVMSignTransactionParams, EVMSignTypedDataParams, EVMSignedTx, EVMTransaction, EVMTransactionEIP1559, EVMTransactionEIP7702, EVMVerifyMessageParams, EthereumSignTypedDataMessage, EthereumSignTypedDataTypeProperty, EthereumSignTypedDataTypes, FIRMWARE, FIRMWARE_EVENT, Features, FilecoinAddress, FilecoinGetAddressParams, FilecoinSignTransactionParams, FilecoinSignedTx, FirmwareEvent, FirmwareMessage, FirmwareProcessing, FirmwareProgress, FirmwareRange, FirmwareRelease, FirmwareTip, FirmwareUpdateBinaryParams, FirmwareUpdateParams, FirmwareUpdateTipMessage, FirmwareUpdateV3Params, FirmwareUpdateV4Params, FirmwareUpdateV4Target, GetDeviceStateParams, GetPassphraseStateParams, HardwareSDKLowLevel, HardwareTopLevelSdk, HardwareUiInteractionMeta, IBLEFirmwareReleaseInfo, IDeviceBLEFirmwareStatus, IDeviceFirmwareStatus, IDeviceModel, IDeviceType, IFRAME, IFirmwareField, IFirmwareReleaseInfo, IFirmwareUpdateProgressType, IFirmwareUpdateTipMessage, IFrameBridge, IFrameCallMessage, IFrameCallback, IFrameCallbackMessage, IFrameCancelMessage, IFrameEvent, IFrameEventMessage, IFrameInit, IFrameSwitchTransport, IFrameSwitchTransportMessage, ILocale, IProtocolV2FirmwareComponent, IProtocolV2FirmwareComponentTarget, IProtocolV2Resource, IProtocolV2ResourceBundle, IProtocolV2ResourceType, IProtocolV2Resources, ITransportStatus, IVersionArray, IVersionRange, KaspaAddress, KaspaGetAddressParams, KaspaSignInputParams, KaspaSignOutputParams, KaspaSignTransactionParams, KaspaSignature, KaspaStreamingSignInputParams, KaspaStreamingSignOutputParams, KnownDevice, LOG, LOG_EVENT, LogBlockEvent, LogEvent, LogEventMessage, LogOutput, LoggerNames, LowLevelCoreApi, LowLevelInjectApi, MajorVersion, MethodResponseMessage, NEMAddress, NEMAggregateModificationTransaction, NEMGetAddressParams, NEMImportanceTransaction, NEMMosaic, NEMMosaicCreationTransaction, NEMMultisigTransaction, NEMProvisionNamespaceTransaction, NEMSignTransactionParams, NEMSupplyChangeTransaction, NEMTransaction, NEMTransferTransaction, NearAddress, NearGetAddressParams, NearSignTransactionParams, NervosAddress, NervosGetAddressParams, NervosSignTransactionParams, NervosSignedTx, NexaAddress, NexaGetAddressParams, NexaSignInputParams, NexaSignOutputParams, NexaSignTransactionParams, NexaSignature, NormalizedFeatures, OnekeyFeatures, OpenWalletSessionMode, OpenWalletSessionModeValue, OpenWalletSessionParams, OpenWalletSessionPayload, PRO2_WALLPAPER_HEIGHT, PRO2_WALLPAPER_WIDTH, PROTOCOL_V2_NEVER_TIMEOUT_MS, Params, PassphraseRequestPayload, PolkadotAddress, PolkadotGetAddressParams, PolkadotSignTransactionParams, PolkadotSignedTx, PostMessageEvent, PreviousAddressResult, Pro2WallpaperColorFormat, ProtocolV2FirmwareComponentRelease, ProtocolV2FirmwareComponentReleaseStatus, ProtocolV2FirmwareReleaseStatus, ProtocolV2UiCompletion, ProtocolV2UiEventMetadata, ProtocolV2UiEventSource, RESPONSE_EVENT, RefTransaction, ReleaseInfo, ReleaseInfoEvent, ReleaseInfoPayload, RemoteConfigResponse, RequestContext, Response, ScdoAddress, ScdoGetAddressParams, ScdoSignMessageParams, ScdoSignTransactionParams, ScdoSignedTx, SdkTracingContext, SearchDevice, SignedTransaction, SolSignMessageParams, SolSignMessageResponse, SolSignOffchainMessageParams, SolSignOffchainMessageResponse, SolanaAddress, SolanaGetAddressParams, SolanaSignTransactionParams, SolanaSignedTx, StarcoinAddress, StarcoinGetAddressParams, StarcoinGetPublicKeyParams, StarcoinPublicKey, StarcoinSignMessageParams, StarcoinSignTransactionParams, StarcoinVerifyMessageParams, StellarAddress, StellarAsset, StellarGetAddressParams, StellarOperation, StellarSignTransactionParams, StellarTransaction, StrictFeatures, Success, SuiAddress, SuiGetAddressParams, SuiGetPublicKeyParams, SuiPublicKey, SuiSignMessageParams, SuiSignTransactionParams, SuiSignedTx, SupportFeatureType, SupportFeatures, TestProtocolV2PingParams, TonAddress, TonGetAddressParams, TonSignDataParams, TonSignMessageParams, TonSignProofParams, TopLevelInjectApi, TransactionOptions, TransportReleaseStatus, TronAddress, TronDelegateResourceContract, TronFreezeBalanceV2Contract, TronGetAddressParams, TronSignMessageParams, TronSignTransactionParams, TronTransaction, TronTransactionContract, TronTransferContract, TronTriggerSmartContract, TronUnDelegateResourceContract, TronUnfreezeBalanceV2Contract, TronWithdrawBalanceContract, TronWithdrawExpireUnfreezeContract, UI_EVENT, UI_REQUEST, UI_RESPONSE, UiEvent, UiEventMessage, UiPromise, UiPromiseResponse, UiRequestButton, UiRequestDeviceAction, UiRequestFirmwareProgressing, UiRequestPassphrase, UiRequestPassphraseOnDevice, UiRequestSelectDeviceForSwitchFirmwareWebDevice, UiRequestSelectDeviceInBootloaderForWebDevice, UiRequestWindowClose, UiRequestWithoutPayload, UiResponseCorrelation, UiResponseCorrelationFields, UiResponseEvent, UiResponseMessage, UiResponsePassphrase, UiResponsePin, UiResponseSelectDeviceForSwitchFirmwareWebDevice, UiResponseSelectDeviceInBootloaderForWebDevice, UnavailableCapabilities, UnavailableCapability, Unsuccessful, VersionArray, checkNeedUpdateBootForClassicAndMini, checkNeedUpdateBootForTouch, cleanupCallback, cleanupSdkInstance, completeRequestContext, corsValidator, createDeviceMessage, createErrorMessage, createFirmwareMessage, createIFrameMessage, createLogMessage, createRequestContext, createResponseMessage, createSdkTracingContext, createUiMessage, createUiResponse, HardwareSdk as default, enableLog, encodePro2Wallpaper, executeCallback, formatLogMethodLabel, formatRequestContext, generateInstanceId, generateSdkInstanceId, getActiveRequestsByDeviceInstance, getAutoLockOptions, getAutoShutDownOptions, getDeviceBLEFirmwareVersion, getDeviceBleName, getDeviceBoardloaderVersion, getDeviceBootloaderVersion, getDeviceFirmwareVersion, getDeviceLabel, getDeviceSerialNo, getDeviceSettingsCapabilities, getDeviceType, getDeviceTypeByBleName, getDeviceUUID, getEnv, getFirmwareType, getFirmwareUpdateField, getFirmwareUpdateFieldArray, getHDPath, getHomeScreenDefaultList, getHomeScreenHex, getHomeScreenSize, getLanguageConfig, getLog, getLogBlockLabel, getLogger, getMethodVersionRange, getNftSize, getOutputScriptType, getSDKVersion, getSafeLogPayload, getScriptType, getTimeStamp, httpRequest, init$1 as initCore, isBleConnect, isValidVersionArray, isValidVersionString, normalizeSafetyCheckLevel, normalizeVersionArray, parseConnectSettings, parseMessage, patchFeatures, preloadSessionCache, safeThrowError, setLoggerPostMessage, supportInputPinOnSoftware, switchTransport, transportEnv, updateRequestContext, versionCompare, versionSplit, wait, whitelist, whitelistExtension };
package/dist/index.js CHANGED
@@ -40355,7 +40355,7 @@ const askDevicePassphrase = (device, requestPayload) => __awaiter(void 0, void 0
40355
40355
  yield refreshProtocolV2DeviceStatus(device);
40356
40356
  });
40357
40357
  const selectDeviceSession = (device, expectedPassphraseState, deriveCardano) => __awaiter(void 0, void 0, void 0, function* () {
40358
- var _a, _b, _c;
40358
+ var _a, _b, _c, _d;
40359
40359
  const existsAttachPinUser = ((_a = device.features) === null || _a === void 0 ? void 0 : _a.attachToPinEnabled) === true;
40360
40360
  const metadata = Object.assign({ source: 'wallet-session-coordinator', reason: expectedPassphraseState ? 'session-recovery' : 'open-wallet' }, (expectedPassphraseState ? { expectedPassphraseState } : {}));
40361
40361
  const passphraseInteraction = (_b = device.createProtocolV2UiPhaseMetadata) === null || _b === void 0 ? void 0 : _b.call(device, 'passphrase', 'start');
@@ -40396,7 +40396,8 @@ const selectDeviceSession = (device, expectedPassphraseState, deriveCardano) =>
40396
40396
  });
40397
40397
  return getDeviceSession(device, buildDeviceSessionGetRequest({ deriveCardano }));
40398
40398
  }
40399
- device.emit(DEVICE.PASSPHRASE_ON_DEVICE, device, Object.assign(Object.assign({}, metadata), (passphraseInteraction ? { interaction: passphraseInteraction } : {})));
40399
+ const passphraseOnDeviceInteraction = (_d = device.createProtocolV2UiPhaseMetadata) === null || _d === void 0 ? void 0 : _d.call(device, 'passphrase-on-device', 'start');
40400
+ device.emit(DEVICE.PASSPHRASE_ON_DEVICE, device, Object.assign(Object.assign({}, metadata), (passphraseOnDeviceInteraction ? { interaction: passphraseOnDeviceInteraction } : {})));
40400
40401
  yield askDevicePassphrase(device, { on_device: true });
40401
40402
  return getDeviceSession(device, buildDeviceSessionGetRequest({ deriveCardano }));
40402
40403
  });
@@ -41368,8 +41369,8 @@ const PRO2_NFT_IMAGE_HEIGHT = 540;
41368
41369
  const PRO2_NFT_THUMBNAIL_WIDTH = 263;
41369
41370
  const PRO2_NFT_THUMBNAIL_HEIGHT = 263;
41370
41371
  const PRO2_NFT_DIRECTORY = 'vol1:/nft';
41371
- const PRO2_NFT_DEFAULT_CHUNK_SIZE = 512;
41372
- const PRO2_NFT_DEFAULT_PACE_MS = 20;
41372
+ const PRO2_NFT_DEFAULT_CHUNK_SIZE = 2048;
41373
+ const PRO2_NFT_DEFAULT_PACE_MS = 0;
41373
41374
  const PRO2_NFT_DEFAULT_TIMEOUT_MS = 15000;
41374
41375
  const PRO2_NFT_MIN_CHUNK_SIZE = 64;
41375
41376
  const PRO2_NFT_MAX_CHUNK_SIZE = 2048;
@@ -49266,7 +49267,7 @@ const isProtocolV2FirmwareFingerprintValid = (binary, fingerprint) => {
49266
49267
  };
49267
49268
  const assertProtocolV2ReconnectIdentity = (expectedSerialNumber, actualSerialNumber) => {
49268
49269
  if (!expectedSerialNumber || !actualSerialNumber) {
49269
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotFound, 'Protocol V2 reconnect physical identity is unavailable');
49270
+ return;
49270
49271
  }
49271
49272
  if (actualSerialNumber !== expectedSerialNumber) {
49272
49273
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotFound, `Protocol V2 reconnect physical identity mismatch: expected ${expectedSerialNumber}, received ${actualSerialNumber}`);
@@ -60824,6 +60825,27 @@ class RequestQueue {
60824
60825
  }
60825
60826
  }
60826
60827
 
60828
+ const isSensitiveUiResponse = (response) => response.type === UI_RESPONSE.RECEIVE_PIN || response.type === UI_RESPONSE.RECEIVE_PASSPHRASE;
60829
+ const findUiPromiseForResponse = (uiPromises, response) => {
60830
+ const candidates = uiPromises.filter(promise => promise.id === response.type);
60831
+ if (!isSensitiveUiResponse(response)) {
60832
+ return candidates[0];
60833
+ }
60834
+ const hasInteractionId = typeof response.interactionId === 'string';
60835
+ const hasDeviceId = typeof response.deviceId === 'string';
60836
+ if (hasInteractionId !== hasDeviceId) {
60837
+ return undefined;
60838
+ }
60839
+ if (hasInteractionId && hasDeviceId) {
60840
+ return candidates.find(promise => {
60841
+ const correlation = promise.responseCorrelation;
60842
+ return ((correlation === null || correlation === void 0 ? void 0 : correlation.interactionId) === response.interactionId &&
60843
+ (correlation === null || correlation === void 0 ? void 0 : correlation.deviceId) === response.deviceId);
60844
+ });
60845
+ }
60846
+ return candidates.length === 1 ? candidates[0] : undefined;
60847
+ };
60848
+
60827
60849
  function registerHardwareUiEventListeners(device, handlers) {
60828
60850
  device.on(DEVICE.PIN, handlers.pin);
60829
60851
  device.on(DEVICE.PIN_ON_DEVICE, handlers.pinOnDevice);
@@ -61759,6 +61781,7 @@ const onDevicePinHandler = (...[device, type, callback]) => __awaiter(void 0, vo
61759
61781
  postMessage(createUiMessage(UI_REQUEST.REQUEST_PIN, {
61760
61782
  device: device.toMessageObject(),
61761
61783
  type,
61784
+ responseCorrelation: uiPromise.responseCorrelation,
61762
61785
  }));
61763
61786
  const uiResp = yield uiPromise.promise;
61764
61787
  callback(null, uiResp.payload);
@@ -61786,7 +61809,7 @@ const onDeviceStateHandler = (...[_, stateEvent]) => {
61786
61809
  const onDevicePassphraseHandler = (...[device, requestPayload, callback]) => __awaiter(void 0, void 0, void 0, function* () {
61787
61810
  Log.debug('onDevicePassphraseHandler');
61788
61811
  const uiPromise = createUiPromise(UI_RESPONSE.RECEIVE_PASSPHRASE, device);
61789
- postMessage(createUiMessage(UI_REQUEST.REQUEST_PASSPHRASE, Object.assign({ device: device.toMessageObject(), passphraseState: device.passphraseState, existsAttachPinUser: requestPayload.existsAttachPinUser, deviceOnly: requestPayload.deviceOnly, source: requestPayload.source, reason: requestPayload.reason, expectedPassphraseState: requestPayload.expectedPassphraseState }, (requestPayload.interaction ? { interaction: requestPayload.interaction } : {}))));
61812
+ postMessage(createUiMessage(UI_REQUEST.REQUEST_PASSPHRASE, Object.assign(Object.assign({ device: device.toMessageObject(), passphraseState: device.passphraseState, existsAttachPinUser: requestPayload.existsAttachPinUser, deviceOnly: requestPayload.deviceOnly, source: requestPayload.source, reason: requestPayload.reason, expectedPassphraseState: requestPayload.expectedPassphraseState }, (requestPayload.interaction ? { interaction: requestPayload.interaction } : {})), { responseCorrelation: uiPromise.responseCorrelation })));
61790
61813
  const uiResp = yield uiPromise.promise;
61791
61814
  const { value, passphraseOnDevice, save, attachPinOnDevice } = uiResp.payload;
61792
61815
  callback({
@@ -61840,11 +61863,19 @@ const postMessage = (message) => {
61840
61863
  _core.emit(CORE_EVENT, message);
61841
61864
  };
61842
61865
  const createUiPromise = (promiseEvent, device) => {
61866
+ var _a;
61843
61867
  const uiPromise = hdShared.createDeferred(promiseEvent, device);
61868
+ if (device &&
61869
+ (promiseEvent === UI_RESPONSE.RECEIVE_PIN || promiseEvent === UI_RESPONSE.RECEIVE_PASSPHRASE)) {
61870
+ const publicDeviceId = (_a = device.toMessageObject()) === null || _a === void 0 ? void 0 : _a.deviceId;
61871
+ uiPromise.responseCorrelation = {
61872
+ interactionId: generateInstanceId('UiResponse', device.sdkInstanceId),
61873
+ deviceId: publicDeviceId || device.instanceId,
61874
+ };
61875
+ }
61844
61876
  _uiPromises.push(uiPromise);
61845
61877
  return uiPromise;
61846
61878
  };
61847
- const findUiPromise = (promiseEvent) => _uiPromises.find(p => p.id === promiseEvent);
61848
61879
  const removeUiPromise = (promise) => {
61849
61880
  _uiPromises = _uiPromises.filter(p => p !== promise);
61850
61881
  };
@@ -61882,12 +61913,16 @@ class Core extends events.exports {
61882
61913
  case UI_RESPONSE.RECEIVE_PASSPHRASE:
61883
61914
  case UI_RESPONSE.SELECT_DEVICE_IN_BOOTLOADER_FOR_WEB_DEVICE:
61884
61915
  case UI_RESPONSE.SELECT_DEVICE_FOR_SWITCH_FIRMWARE_WEB_DEVICE: {
61885
- const uiPromise = findUiPromise(message.type);
61916
+ const uiPromise = findUiPromiseForResponse(_uiPromises, message);
61886
61917
  if (uiPromise) {
61887
61918
  Log.log('receive UI Response: ', message.type);
61888
61919
  uiPromise.resolve(message);
61889
61920
  removeUiPromise(uiPromise);
61890
61921
  }
61922
+ else if (message.type === UI_RESPONSE.RECEIVE_PIN ||
61923
+ message.type === UI_RESPONSE.RECEIVE_PASSPHRASE) {
61924
+ Log.warn('Ignored unmatched or ambiguous sensitive UI response:', message.type);
61925
+ }
61891
61926
  break;
61892
61927
  }
61893
61928
  case UI_REQUEST.BLUETOOTH_UNSUPPORTED:
@@ -1 +1 @@
1
- {"version":3,"file":"walletSession.d.ts","sourceRoot":"","sources":["../../../src/protocols/protocol-v2/walletSession.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAuBlD,wBAAsB,6BAA6B,CAAC,MAAM,EAAE,MAAM,0DAGjE;AAED,wBAAsB,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AAsB,8BAA8B,CAClD,MAAM,EAAE,MAAM,EACd,uBAAuB,EAAE,MAAM,EAC/B,aAAa,CAAC,EAAE,OAAO;;;;;GAOxB"}
@@ -3,8 +3,8 @@ export declare const PRO2_NFT_IMAGE_HEIGHT = 540;
3
3
  export declare const PRO2_NFT_THUMBNAIL_WIDTH = 263;
4
4
  export declare const PRO2_NFT_THUMBNAIL_HEIGHT = 263;
5
5
  export declare const PRO2_NFT_DIRECTORY = "vol1:/nft";
6
- export declare const PRO2_NFT_DEFAULT_CHUNK_SIZE = 512;
7
- export declare const PRO2_NFT_DEFAULT_PACE_MS = 20;
6
+ export declare const PRO2_NFT_DEFAULT_CHUNK_SIZE = 2048;
7
+ export declare const PRO2_NFT_DEFAULT_PACE_MS = 0;
8
8
  export declare const PRO2_NFT_DEFAULT_TIMEOUT_MS = 15000;
9
9
  export declare const PRO2_NFT_MIN_CHUNK_SIZE = 64;
10
10
  export declare const PRO2_NFT_MAX_CHUNK_SIZE = 2048;
@@ -1 +1 @@
1
- {"version":3,"file":"pro2Nft.d.ts","sourceRoot":"","sources":["../../src/utils/pro2Nft.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,oBAAoB,MAAM,CAAC;AACxC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAC5C,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAC7C,eAAO,MAAM,kBAAkB,cAAc,CAAC;AAC9C,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAC/C,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAClD,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAC5C,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;I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AAE,MAAM,CAAC;IACjB,KAAK,EAAE,UAAU,CAAC;IAClB,SAAS,EAAE,UAAU,CAAC;IACtB,QAAQ,EAAE,UAAU,CAAC;CACtB,CAAC;AAiCF,wBAAgB,2BAA2B,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAiB5E;AAsBD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAC1C,KAAK,EAAE,YAAY,CAAC;IACpB,SAAS,EAAE,YAAY,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,aAAa,CAkChB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "1.2.0-alpha.44",
3
+ "version": "1.2.0-alpha.46",
4
4
  "description": "Core processes and APIs for communicating with OneKey hardware devices.",
5
5
  "author": "OneKey",
6
6
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
@@ -25,8 +25,8 @@
25
25
  "url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
26
26
  },
27
27
  "dependencies": {
28
- "@onekeyfe/hd-shared": "1.2.0-alpha.44",
29
- "@onekeyfe/hd-transport": "1.2.0-alpha.44",
28
+ "@onekeyfe/hd-shared": "1.2.0-alpha.46",
29
+ "@onekeyfe/hd-transport": "1.2.0-alpha.46",
30
30
  "axios": "1.15.2",
31
31
  "bignumber.js": "^9.0.2",
32
32
  "bytebuffer": "^5.0.1",
@@ -44,5 +44,5 @@
44
44
  "@types/w3c-web-usb": "^1.0.10",
45
45
  "@types/web-bluetooth": "^0.0.21"
46
46
  },
47
- "gitHead": "6de180b61cd4a64f41cf4ffd32eeb8a1cc4e64e7"
47
+ "gitHead": "23bc93ba87e4f8557380c636b308aea06f569ae2"
48
48
  }
@@ -369,11 +369,10 @@ export const assertProtocolV2ReconnectIdentity = (
369
369
  expectedSerialNumber?: string,
370
370
  actualSerialNumber?: string
371
371
  ) => {
372
+ // Some Pro2 loader builds omit serial_no. Reconnect still uses the same BLE
373
+ // descriptor or requires a uniquely enumerated USB device before this check.
372
374
  if (!expectedSerialNumber || !actualSerialNumber) {
373
- throw ERRORS.TypedError(
374
- HardwareErrorCode.DeviceNotFound,
375
- 'Protocol V2 reconnect physical identity is unavailable'
376
- );
375
+ return;
377
376
  }
378
377
  if (actualSerialNumber !== expectedSerialNumber) {
379
378
  throw ERRORS.TypedError(
package/src/core/index.ts CHANGED
@@ -26,6 +26,7 @@ import {
26
26
  createRequestContext,
27
27
  createSdkTracingContext,
28
28
  formatRequestContext,
29
+ generateInstanceId,
29
30
  getActiveRequestsByDeviceInstance,
30
31
  updateRequestContext,
31
32
  } from '../utils/tracing';
@@ -53,6 +54,7 @@ import {
53
54
  import TransportManager from '../data-manager/TransportManager';
54
55
  import DeviceConnector from '../device/DeviceConnector';
55
56
  import RequestQueue from './RequestQueue';
57
+ import { findUiPromiseForResponse } from './uiPromiseRegistry';
56
58
  import { registerHardwareUiEventListeners } from './deviceEventRegistration';
57
59
  import { getSynchronize } from '../utils/getSynchronize';
58
60
  import { runMethodWithUnlockPolicy } from '../protocols/protocol-v2/unlockPolicyRunner';
@@ -1260,6 +1262,7 @@ const onDevicePinHandler = async (...[device, type, callback]: DeviceEvents['pin
1260
1262
  createUiMessage(UI_REQUEST.REQUEST_PIN, {
1261
1263
  device: device.toMessageObject() as unknown as KnownDevice,
1262
1264
  type,
1265
+ responseCorrelation: uiPromise.responseCorrelation,
1263
1266
  })
1264
1267
  );
1265
1268
  // wait for pin
@@ -1308,6 +1311,7 @@ const onDevicePassphraseHandler = async (
1308
1311
  reason: requestPayload.reason,
1309
1312
  expectedPassphraseState: requestPayload.expectedPassphraseState,
1310
1313
  ...(requestPayload.interaction ? { interaction: requestPayload.interaction } : {}),
1314
+ responseCorrelation: uiPromise.responseCorrelation,
1311
1315
  })
1312
1316
  );
1313
1317
  // wait for passphrase
@@ -1431,14 +1435,21 @@ const postMessage = (message: CoreMessage) => {
1431
1435
 
1432
1436
  const createUiPromise = <T extends UiPromiseResponse['type']>(promiseEvent: T, device?: Device) => {
1433
1437
  const uiPromise: UiPromise<T> = createDeferred(promiseEvent, device);
1438
+ if (
1439
+ device &&
1440
+ (promiseEvent === UI_RESPONSE.RECEIVE_PIN || promiseEvent === UI_RESPONSE.RECEIVE_PASSPHRASE)
1441
+ ) {
1442
+ const publicDeviceId = device.toMessageObject()?.deviceId;
1443
+ uiPromise.responseCorrelation = {
1444
+ interactionId: generateInstanceId('UiResponse', device.sdkInstanceId),
1445
+ deviceId: publicDeviceId || device.instanceId,
1446
+ };
1447
+ }
1434
1448
  _uiPromises.push(uiPromise as any);
1435
1449
 
1436
1450
  return uiPromise;
1437
1451
  };
1438
1452
 
1439
- const findUiPromise = <T extends UiPromiseResponse['type']>(promiseEvent: T) =>
1440
- _uiPromises.find(p => p.id === promiseEvent);
1441
-
1442
1453
  const removeUiPromise = (promise: Deferred<any>) => {
1443
1454
  _uiPromises = _uiPromises.filter(p => p !== promise);
1444
1455
  };
@@ -1490,11 +1501,16 @@ export default class Core extends EventEmitter {
1490
1501
  case UI_RESPONSE.RECEIVE_PASSPHRASE:
1491
1502
  case UI_RESPONSE.SELECT_DEVICE_IN_BOOTLOADER_FOR_WEB_DEVICE:
1492
1503
  case UI_RESPONSE.SELECT_DEVICE_FOR_SWITCH_FIRMWARE_WEB_DEVICE: {
1493
- const uiPromise = findUiPromise(message.type);
1504
+ const uiPromise = findUiPromiseForResponse(_uiPromises, message);
1494
1505
  if (uiPromise) {
1495
1506
  Log.log('receive UI Response: ', message.type);
1496
1507
  uiPromise.resolve(message);
1497
1508
  removeUiPromise(uiPromise);
1509
+ } else if (
1510
+ message.type === UI_RESPONSE.RECEIVE_PIN ||
1511
+ message.type === UI_RESPONSE.RECEIVE_PASSPHRASE
1512
+ ) {
1513
+ Log.warn('Ignored unmatched or ambiguous sensitive UI response:', message.type);
1498
1514
  }
1499
1515
  break;
1500
1516
  }
@@ -0,0 +1,41 @@
1
+ import { UI_RESPONSE } from '../events/ui-response';
2
+
3
+ import type { UiPromise, UiPromiseResponse } from '../events/ui-promise';
4
+ import type { UiResponseEvent } from '../events/ui-response';
5
+
6
+ const isSensitiveUiResponse = (
7
+ response: UiResponseEvent
8
+ ): response is Extract<
9
+ UiResponseEvent,
10
+ { type: typeof UI_RESPONSE.RECEIVE_PIN | typeof UI_RESPONSE.RECEIVE_PASSPHRASE }
11
+ > => response.type === UI_RESPONSE.RECEIVE_PIN || response.type === UI_RESPONSE.RECEIVE_PASSPHRASE;
12
+
13
+ export const findUiPromiseForResponse = (
14
+ uiPromises: UiPromise<UiPromiseResponse['type']>[],
15
+ response: UiResponseEvent
16
+ ) => {
17
+ const candidates = uiPromises.filter(promise => promise.id === response.type);
18
+ if (!isSensitiveUiResponse(response)) {
19
+ return candidates[0];
20
+ }
21
+
22
+ const hasInteractionId = typeof response.interactionId === 'string';
23
+ const hasDeviceId = typeof response.deviceId === 'string';
24
+ if (hasInteractionId !== hasDeviceId) {
25
+ return undefined;
26
+ }
27
+
28
+ if (hasInteractionId && hasDeviceId) {
29
+ return candidates.find(promise => {
30
+ const correlation = promise.responseCorrelation;
31
+ return (
32
+ correlation?.interactionId === response.interactionId &&
33
+ correlation?.deviceId === response.deviceId
34
+ );
35
+ });
36
+ }
37
+
38
+ // Legacy clients do not return correlation metadata. Preserve their single-request
39
+ // behavior, but never guess when multiple sensitive requests are pending.
40
+ return candidates.length === 1 ? candidates[0] : undefined;
41
+ };
@@ -1,7 +1,7 @@
1
1
  import type { Deferred } from '@onekeyfe/hd-shared';
2
2
  import type { DEVICE } from './device';
3
3
  import type { Device } from '../device/Device';
4
- import type { UiResponseEvent } from './ui-response';
4
+ import type { UiResponseCorrelation, UiResponseEvent } from './ui-response';
5
5
 
6
6
  export type UiPromiseResponse =
7
7
  | UiResponseEvent
@@ -11,4 +11,6 @@ export type UiPromise<T extends UiPromiseResponse['type']> = Deferred<
11
11
  Extract<UiPromiseResponse, { type: T }>,
12
12
  T,
13
13
  Device
14
- >;
14
+ > & {
15
+ responseCorrelation?: UiResponseCorrelation;
16
+ };
@@ -1,6 +1,7 @@
1
1
  import type { PROTO } from '../constants';
2
2
  import type { Device } from '../types';
3
3
  import type { DeviceButtonRequest } from './device';
4
+ import type { UiResponseCorrelation } from './ui-response';
4
5
  import type { MessageFactoryFn } from './utils';
5
6
 
6
7
  export const UI_EVENT = 'UI_EVENT';
@@ -121,6 +122,7 @@ export type UiRequestDeviceAction = {
121
122
  payload: ProtocolV2UiEventMetadata & {
122
123
  device: Device;
123
124
  type?: PROTO.PinMatrixRequestType | 'ButtonRequest_PinEntry' | 'ButtonRequest_AttachPin';
125
+ responseCorrelation?: UiResponseCorrelation;
124
126
  };
125
127
  };
126
128
 
@@ -140,6 +142,7 @@ export interface UiRequestPassphrase {
140
142
  reason?: 'open-wallet' | 'session-recovery';
141
143
  expectedPassphraseState?: string;
142
144
  interaction?: HardwareUiInteractionMeta;
145
+ responseCorrelation?: UiResponseCorrelation;
143
146
  };
144
147
  }
145
148
 
@@ -11,12 +11,22 @@ export const UI_RESPONSE = {
11
11
  'ui-receive_select-device-for-switch-firmware-web-device',
12
12
  } as const;
13
13
 
14
- export interface UiResponsePin {
14
+ export interface UiResponseCorrelation {
15
+ interactionId: string;
16
+ deviceId: string;
17
+ }
18
+
19
+ export interface UiResponseCorrelationFields {
20
+ interactionId?: string;
21
+ deviceId?: string;
22
+ }
23
+
24
+ export interface UiResponsePin extends UiResponseCorrelationFields {
15
25
  type: typeof UI_RESPONSE.RECEIVE_PIN;
16
26
  payload: string;
17
27
  }
18
28
 
19
- export interface UiResponsePassphrase {
29
+ export interface UiResponsePassphrase extends UiResponseCorrelationFields {
20
30
  type: typeof UI_RESPONSE.RECEIVE_PASSPHRASE;
21
31
  payload: {
22
32
  value: string;
@@ -164,9 +164,13 @@ const selectDeviceSession = async (
164
164
  return getDeviceSession(device, buildDeviceSessionGetRequest({ deriveCardano }));
165
165
  }
166
166
 
167
+ const passphraseOnDeviceInteraction = device.createProtocolV2UiPhaseMetadata?.(
168
+ 'passphrase-on-device',
169
+ 'start'
170
+ );
167
171
  device.emit(DEVICE.PASSPHRASE_ON_DEVICE, device, {
168
172
  ...metadata,
169
- ...(passphraseInteraction ? { interaction: passphraseInteraction } : {}),
173
+ ...(passphraseOnDeviceInteraction ? { interaction: passphraseOnDeviceInteraction } : {}),
170
174
  });
171
175
  await askDevicePassphrase(device, { on_device: true });
172
176
  return getDeviceSession(device, buildDeviceSessionGetRequest({ deriveCardano }));
@@ -9,8 +9,8 @@ export const PRO2_NFT_IMAGE_HEIGHT = 540;
9
9
  export const PRO2_NFT_THUMBNAIL_WIDTH = 263;
10
10
  export const PRO2_NFT_THUMBNAIL_HEIGHT = 263;
11
11
  export const PRO2_NFT_DIRECTORY = 'vol1:/nft';
12
- export const PRO2_NFT_DEFAULT_CHUNK_SIZE = 512;
13
- export const PRO2_NFT_DEFAULT_PACE_MS = 20;
12
+ export const PRO2_NFT_DEFAULT_CHUNK_SIZE = 2048;
13
+ export const PRO2_NFT_DEFAULT_PACE_MS = 0;
14
14
  export const PRO2_NFT_DEFAULT_TIMEOUT_MS = 15_000;
15
15
  export const PRO2_NFT_MIN_CHUNK_SIZE = 64;
16
16
  export const PRO2_NFT_MAX_CHUNK_SIZE = 2048;