@onekeyfe/hd-core 1.2.0-alpha.45 → 1.2.0-alpha.47

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 () => {
@@ -5798,16 +5798,10 @@ describe('Protocol V2 firmware reconnect identity', () => {
5798
5798
  ).not.toThrow();
5799
5799
  });
5800
5800
 
5801
- test('fails closed when the physical serial is unavailable', () => {
5802
- expect(() => assertProtocolV2ReconnectIdentity('expected-serial', undefined)).toThrow(
5803
- expect.objectContaining({ errorCode: HardwareErrorCode.DeviceNotFound })
5804
- );
5805
- expect(() => assertProtocolV2ReconnectIdentity(undefined, 'actual-serial')).toThrow(
5806
- expect.objectContaining({ errorCode: HardwareErrorCode.DeviceNotFound })
5807
- );
5808
- expect(() => assertProtocolV2ReconnectIdentity(undefined, undefined)).toThrow(
5809
- expect.objectContaining({ errorCode: HardwareErrorCode.DeviceNotFound })
5810
- );
5801
+ test('allows reconnect when either physical serial is unavailable', () => {
5802
+ expect(() => assertProtocolV2ReconnectIdentity('expected-serial', undefined)).not.toThrow();
5803
+ expect(() => assertProtocolV2ReconnectIdentity(undefined, 'actual-serial')).not.toThrow();
5804
+ expect(() => assertProtocolV2ReconnectIdentity(undefined, undefined)).not.toThrow();
5811
5805
  });
5812
5806
 
5813
5807
  test('captures physical identity from active DeviceInfo instead of wallet deviceId', async () => {
@@ -5840,7 +5834,7 @@ describe('Protocol V2 firmware reconnect identity', () => {
5840
5834
  );
5841
5835
  });
5842
5836
 
5843
- test('rejects firmware update startup when DeviceInfo has no physical serial', async () => {
5837
+ test('allows firmware update startup when DeviceInfo has no physical serial', async () => {
5844
5838
  const method = new FirmwareUpdateV4({
5845
5839
  id: 1,
5846
5840
  payload: { method: 'firmwareUpdateV4' },
@@ -5853,9 +5847,8 @@ describe('Protocol V2 firmware reconnect identity', () => {
5853
5847
  getCommands: () => ({ typedCall }),
5854
5848
  });
5855
5849
 
5856
- await expect((method as any).captureProtocolV2PhysicalIdentity()).rejects.toMatchObject({
5857
- errorCode: HardwareErrorCode.DeviceNotFound,
5858
- });
5850
+ await expect((method as any).captureProtocolV2PhysicalIdentity()).resolves.toBeUndefined();
5851
+ expect((method as any).protocolV2ExpectedSerialNumber).toBeUndefined();
5859
5852
  });
5860
5853
 
5861
5854
  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;AAiUlG,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;IA6DJ,OAAO,CAAC,8BAA8B;IAiBhC,GAAG;;;;;YAKK,aAAa;YAqFb,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;IASpC,OAAO,CAAC,2BAA2B;IAsBnC,OAAO,CAAC,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AYxD,OAAO,KAAK,EAAE,eAAe,EAAyB,MAAM,UAAU,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAmD,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,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BAAkB,uBAAuB;IACzC,gBAAgB,qBAAqB;IACrC,uBAAuB,4BAA4B;IACnD,iBAAiB,sBAAsB;IACvC,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,WAA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W,2BAA2B;IAC1C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;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
@@ -3901,6 +3901,51 @@ type DeviceEventMessage = DeviceEvent & {
3901
3901
  type DeviceEventListenerFn = (type: typeof DEVICE_EVENT, cb: (event: DeviceEventMessage) => void) => void;
3902
3902
  declare const createDeviceMessage: MessageFactoryFn<typeof DEVICE_EVENT, DeviceEvent>;
3903
3903
 
3904
+ declare const UI_RESPONSE: {
3905
+ readonly RECEIVE_PIN: "ui-receive_pin";
3906
+ readonly RECEIVE_PASSPHRASE: "ui-receive_passphrase";
3907
+ readonly SELECT_DEVICE_IN_BOOTLOADER_FOR_WEB_DEVICE: "ui-receive_select-device-in-bootloader-for-web-device";
3908
+ readonly SELECT_DEVICE_FOR_SWITCH_FIRMWARE_WEB_DEVICE: "ui-receive_select-device-for-switch-firmware-web-device";
3909
+ };
3910
+ interface UiResponseCorrelation {
3911
+ interactionId: string;
3912
+ deviceId: string;
3913
+ }
3914
+ interface UiResponseCorrelationFields {
3915
+ interactionId?: string;
3916
+ deviceId?: string;
3917
+ }
3918
+ interface UiResponsePin extends UiResponseCorrelationFields {
3919
+ type: typeof UI_RESPONSE.RECEIVE_PIN;
3920
+ payload: string;
3921
+ }
3922
+ interface UiResponsePassphrase extends UiResponseCorrelationFields {
3923
+ type: typeof UI_RESPONSE.RECEIVE_PASSPHRASE;
3924
+ payload: {
3925
+ value: string;
3926
+ passphraseOnDevice?: boolean;
3927
+ attachPinOnDevice?: boolean;
3928
+ save?: boolean;
3929
+ };
3930
+ }
3931
+ interface UiResponseSelectDeviceInBootloaderForWebDevice {
3932
+ type: typeof UI_RESPONSE.SELECT_DEVICE_IN_BOOTLOADER_FOR_WEB_DEVICE;
3933
+ payload: {
3934
+ deviceId: string;
3935
+ };
3936
+ }
3937
+ interface UiResponseSelectDeviceForSwitchFirmwareWebDevice {
3938
+ type: typeof UI_RESPONSE.SELECT_DEVICE_FOR_SWITCH_FIRMWARE_WEB_DEVICE;
3939
+ payload: {
3940
+ deviceId: string;
3941
+ };
3942
+ }
3943
+ type UiResponseEvent = UiResponsePin | UiResponsePassphrase | UiResponseSelectDeviceInBootloaderForWebDevice | UiResponseSelectDeviceForSwitchFirmwareWebDevice;
3944
+ type UiResponseMessage = UiResponseEvent & {
3945
+ event: typeof UI_EVENT;
3946
+ };
3947
+ declare const createUiResponse: MessageFactoryFn<typeof UI_EVENT, UiResponseEvent>;
3948
+
3904
3949
  declare const UI_EVENT = "UI_EVENT";
3905
3950
  declare const UI_REQUEST: {
3906
3951
  readonly REQUEST_PIN: "ui-request_pin";
@@ -3985,6 +4030,7 @@ type UiRequestDeviceAction = {
3985
4030
  payload: ProtocolV2UiEventMetadata & {
3986
4031
  device: Device$1;
3987
4032
  type?: Messages.PinMatrixRequestType | 'ButtonRequest_PinEntry' | 'ButtonRequest_AttachPin';
4033
+ responseCorrelation?: UiResponseCorrelation;
3988
4034
  };
3989
4035
  };
3990
4036
  interface UiRequestButton {
@@ -4002,6 +4048,7 @@ interface UiRequestPassphrase {
4002
4048
  reason?: 'open-wallet' | 'session-recovery';
4003
4049
  expectedPassphraseState?: string;
4004
4050
  interaction?: HardwareUiInteractionMeta;
4051
+ responseCorrelation?: UiResponseCorrelation;
4005
4052
  };
4006
4053
  }
4007
4054
  interface UiRequestPassphraseOnDevice {
@@ -4208,43 +4255,6 @@ interface MethodResponseMessage {
4208
4255
  declare const createResponseMessage: (id: number, success: boolean, payload: any) => MethodResponseMessage;
4209
4256
  type CallMethodKeys = keyof CoreApi;
4210
4257
 
4211
- declare const UI_RESPONSE: {
4212
- readonly RECEIVE_PIN: "ui-receive_pin";
4213
- readonly RECEIVE_PASSPHRASE: "ui-receive_passphrase";
4214
- readonly SELECT_DEVICE_IN_BOOTLOADER_FOR_WEB_DEVICE: "ui-receive_select-device-in-bootloader-for-web-device";
4215
- readonly SELECT_DEVICE_FOR_SWITCH_FIRMWARE_WEB_DEVICE: "ui-receive_select-device-for-switch-firmware-web-device";
4216
- };
4217
- interface UiResponsePin {
4218
- type: typeof UI_RESPONSE.RECEIVE_PIN;
4219
- payload: string;
4220
- }
4221
- interface UiResponsePassphrase {
4222
- type: typeof UI_RESPONSE.RECEIVE_PASSPHRASE;
4223
- payload: {
4224
- value: string;
4225
- passphraseOnDevice?: boolean;
4226
- attachPinOnDevice?: boolean;
4227
- save?: boolean;
4228
- };
4229
- }
4230
- interface UiResponseSelectDeviceInBootloaderForWebDevice {
4231
- type: typeof UI_RESPONSE.SELECT_DEVICE_IN_BOOTLOADER_FOR_WEB_DEVICE;
4232
- payload: {
4233
- deviceId: string;
4234
- };
4235
- }
4236
- interface UiResponseSelectDeviceForSwitchFirmwareWebDevice {
4237
- type: typeof UI_RESPONSE.SELECT_DEVICE_FOR_SWITCH_FIRMWARE_WEB_DEVICE;
4238
- payload: {
4239
- deviceId: string;
4240
- };
4241
- }
4242
- type UiResponseEvent = UiResponsePin | UiResponsePassphrase | UiResponseSelectDeviceInBootloaderForWebDevice | UiResponseSelectDeviceForSwitchFirmwareWebDevice;
4243
- type UiResponseMessage = UiResponseEvent & {
4244
- event: typeof UI_EVENT;
4245
- };
4246
- declare const createUiResponse: MessageFactoryFn<typeof UI_EVENT, UiResponseEvent>;
4247
-
4248
4258
  declare const LOG_EVENT = "LOG_EVENT";
4249
4259
  declare const LOG: {
4250
4260
  readonly OUTPUT: "log-output";
@@ -4320,7 +4330,9 @@ type UiPromiseResponse = UiResponseEvent | {
4320
4330
  };
4321
4331
  type UiPromise<T extends UiPromiseResponse['type']> = Deferred<Extract<UiPromiseResponse, {
4322
4332
  type: T;
4323
- }>, T, Device>;
4333
+ }>, T, Device> & {
4334
+ responseCorrelation?: UiResponseCorrelation;
4335
+ };
4324
4336
 
4325
4337
  declare const LogBlockEvent: Set<string>;
4326
4338
  declare function getLogBlockLabel(message: unknown): string | undefined;
@@ -4661,4 +4673,4 @@ declare const HardwareSdk: ({ init, call, dispose, eventEmitter, uiResponse, can
4661
4673
  declare const HardwareSDKLowLevel: ({ init, call, dispose, eventEmitter, addHardwareGlobalEventListener, uiResponse, cancel, updateSettings, switchTransport, }: LowLevelInjectApi) => LowLevelCoreApi;
4662
4674
  declare const HardwareTopLevelSdk: () => CoreApi;
4663
4675
 
4664
- 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, IProtocolV2BootResources, 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 };
4676
+ 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, IProtocolV2BootResources, 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
@@ -40386,7 +40386,7 @@ const askDevicePassphrase = (device, requestPayload) => __awaiter(void 0, void 0
40386
40386
  yield refreshProtocolV2DeviceStatus(device);
40387
40387
  });
40388
40388
  const selectDeviceSession = (device, expectedPassphraseState, deriveCardano) => __awaiter(void 0, void 0, void 0, function* () {
40389
- var _a, _b, _c;
40389
+ var _a, _b, _c, _d;
40390
40390
  const existsAttachPinUser = ((_a = device.features) === null || _a === void 0 ? void 0 : _a.attachToPinEnabled) === true;
40391
40391
  const metadata = Object.assign({ source: 'wallet-session-coordinator', reason: expectedPassphraseState ? 'session-recovery' : 'open-wallet' }, (expectedPassphraseState ? { expectedPassphraseState } : {}));
40392
40392
  const passphraseInteraction = (_b = device.createProtocolV2UiPhaseMetadata) === null || _b === void 0 ? void 0 : _b.call(device, 'passphrase', 'start');
@@ -40427,7 +40427,8 @@ const selectDeviceSession = (device, expectedPassphraseState, deriveCardano) =>
40427
40427
  });
40428
40428
  return getDeviceSession(device, buildDeviceSessionGetRequest({ deriveCardano }));
40429
40429
  }
40430
- device.emit(DEVICE.PASSPHRASE_ON_DEVICE, device, Object.assign(Object.assign({}, metadata), (passphraseInteraction ? { interaction: passphraseInteraction } : {})));
40430
+ const passphraseOnDeviceInteraction = (_d = device.createProtocolV2UiPhaseMetadata) === null || _d === void 0 ? void 0 : _d.call(device, 'passphrase-on-device', 'start');
40431
+ device.emit(DEVICE.PASSPHRASE_ON_DEVICE, device, Object.assign(Object.assign({}, metadata), (passphraseOnDeviceInteraction ? { interaction: passphraseOnDeviceInteraction } : {})));
40431
40432
  yield askDevicePassphrase(device, { on_device: true });
40432
40433
  return getDeviceSession(device, buildDeviceSessionGetRequest({ deriveCardano }));
40433
40434
  });
@@ -41399,8 +41400,8 @@ const PRO2_NFT_IMAGE_HEIGHT = 540;
41399
41400
  const PRO2_NFT_THUMBNAIL_WIDTH = 263;
41400
41401
  const PRO2_NFT_THUMBNAIL_HEIGHT = 263;
41401
41402
  const PRO2_NFT_DIRECTORY = 'vol1:/nft';
41402
- const PRO2_NFT_DEFAULT_CHUNK_SIZE = 512;
41403
- const PRO2_NFT_DEFAULT_PACE_MS = 20;
41403
+ const PRO2_NFT_DEFAULT_CHUNK_SIZE = 2048;
41404
+ const PRO2_NFT_DEFAULT_PACE_MS = 0;
41404
41405
  const PRO2_NFT_DEFAULT_TIMEOUT_MS = 15000;
41405
41406
  const PRO2_NFT_MIN_CHUNK_SIZE = 64;
41406
41407
  const PRO2_NFT_MAX_CHUNK_SIZE = 2048;
@@ -49298,7 +49299,7 @@ const isProtocolV2FirmwareFingerprintValid = (binary, fingerprint) => {
49298
49299
  };
49299
49300
  const assertProtocolV2ReconnectIdentity = (expectedSerialNumber, actualSerialNumber) => {
49300
49301
  if (!expectedSerialNumber || !actualSerialNumber) {
49301
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotFound, 'Protocol V2 reconnect physical identity is unavailable');
49302
+ return;
49302
49303
  }
49303
49304
  if (actualSerialNumber !== expectedSerialNumber) {
49304
49305
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotFound, `Protocol V2 reconnect physical identity mismatch: expected ${expectedSerialNumber}, received ${actualSerialNumber}`);
@@ -60916,6 +60917,27 @@ class RequestQueue {
60916
60917
  }
60917
60918
  }
60918
60919
 
60920
+ const isSensitiveUiResponse = (response) => response.type === UI_RESPONSE.RECEIVE_PIN || response.type === UI_RESPONSE.RECEIVE_PASSPHRASE;
60921
+ const findUiPromiseForResponse = (uiPromises, response) => {
60922
+ const candidates = uiPromises.filter(promise => promise.id === response.type);
60923
+ if (!isSensitiveUiResponse(response)) {
60924
+ return candidates[0];
60925
+ }
60926
+ const hasInteractionId = typeof response.interactionId === 'string';
60927
+ const hasDeviceId = typeof response.deviceId === 'string';
60928
+ if (hasInteractionId !== hasDeviceId) {
60929
+ return undefined;
60930
+ }
60931
+ if (hasInteractionId && hasDeviceId) {
60932
+ return candidates.find(promise => {
60933
+ const correlation = promise.responseCorrelation;
60934
+ return ((correlation === null || correlation === void 0 ? void 0 : correlation.interactionId) === response.interactionId &&
60935
+ (correlation === null || correlation === void 0 ? void 0 : correlation.deviceId) === response.deviceId);
60936
+ });
60937
+ }
60938
+ return candidates.length === 1 ? candidates[0] : undefined;
60939
+ };
60940
+
60919
60941
  function registerHardwareUiEventListeners(device, handlers) {
60920
60942
  device.on(DEVICE.PIN, handlers.pin);
60921
60943
  device.on(DEVICE.PIN_ON_DEVICE, handlers.pinOnDevice);
@@ -61851,6 +61873,7 @@ const onDevicePinHandler = (...[device, type, callback]) => __awaiter(void 0, vo
61851
61873
  postMessage(createUiMessage(UI_REQUEST.REQUEST_PIN, {
61852
61874
  device: device.toMessageObject(),
61853
61875
  type,
61876
+ responseCorrelation: uiPromise.responseCorrelation,
61854
61877
  }));
61855
61878
  const uiResp = yield uiPromise.promise;
61856
61879
  callback(null, uiResp.payload);
@@ -61878,7 +61901,7 @@ const onDeviceStateHandler = (...[_, stateEvent]) => {
61878
61901
  const onDevicePassphraseHandler = (...[device, requestPayload, callback]) => __awaiter(void 0, void 0, void 0, function* () {
61879
61902
  Log.debug('onDevicePassphraseHandler');
61880
61903
  const uiPromise = createUiPromise(UI_RESPONSE.RECEIVE_PASSPHRASE, device);
61881
- 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 } : {}))));
61904
+ 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 })));
61882
61905
  const uiResp = yield uiPromise.promise;
61883
61906
  const { value, passphraseOnDevice, save, attachPinOnDevice } = uiResp.payload;
61884
61907
  callback({
@@ -61932,11 +61955,19 @@ const postMessage = (message) => {
61932
61955
  _core.emit(CORE_EVENT, message);
61933
61956
  };
61934
61957
  const createUiPromise = (promiseEvent, device) => {
61958
+ var _a;
61935
61959
  const uiPromise = hdShared.createDeferred(promiseEvent, device);
61960
+ if (device &&
61961
+ (promiseEvent === UI_RESPONSE.RECEIVE_PIN || promiseEvent === UI_RESPONSE.RECEIVE_PASSPHRASE)) {
61962
+ const publicDeviceId = (_a = device.toMessageObject()) === null || _a === void 0 ? void 0 : _a.deviceId;
61963
+ uiPromise.responseCorrelation = {
61964
+ interactionId: generateInstanceId('UiResponse', device.sdkInstanceId),
61965
+ deviceId: publicDeviceId || device.instanceId,
61966
+ };
61967
+ }
61936
61968
  _uiPromises.push(uiPromise);
61937
61969
  return uiPromise;
61938
61970
  };
61939
- const findUiPromise = (promiseEvent) => _uiPromises.find(p => p.id === promiseEvent);
61940
61971
  const removeUiPromise = (promise) => {
61941
61972
  _uiPromises = _uiPromises.filter(p => p !== promise);
61942
61973
  };
@@ -61974,12 +62005,16 @@ class Core extends events.exports {
61974
62005
  case UI_RESPONSE.RECEIVE_PASSPHRASE:
61975
62006
  case UI_RESPONSE.SELECT_DEVICE_IN_BOOTLOADER_FOR_WEB_DEVICE:
61976
62007
  case UI_RESPONSE.SELECT_DEVICE_FOR_SWITCH_FIRMWARE_WEB_DEVICE: {
61977
- const uiPromise = findUiPromise(message.type);
62008
+ const uiPromise = findUiPromiseForResponse(_uiPromises, message);
61978
62009
  if (uiPromise) {
61979
62010
  Log.log('receive UI Response: ', message.type);
61980
62011
  uiPromise.resolve(message);
61981
62012
  removeUiPromise(uiPromise);
61982
62013
  }
62014
+ else if (message.type === UI_RESPONSE.RECEIVE_PIN ||
62015
+ message.type === UI_RESPONSE.RECEIVE_PASSPHRASE) {
62016
+ Log.warn('Ignored unmatched or ambiguous sensitive UI response:', message.type);
62017
+ }
61983
62018
  break;
61984
62019
  }
61985
62020
  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,OAA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C,EAAE,OAAO,CAAC;IACxC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;;;;;GA8NF;AAED,wBAAsB,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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,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,UAAU,GAAG,WAAW,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,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.45",
3
+ "version": "1.2.0-alpha.47",
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.45",
29
- "@onekeyfe/hd-transport": "1.2.0-alpha.45",
28
+ "@onekeyfe/hd-shared": "1.2.0-alpha.47",
29
+ "@onekeyfe/hd-transport": "1.2.0-alpha.47",
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": "8fc6c0d642bfaa268d23a2aa2a98e235d1a876f6"
47
+ "gitHead": "a4ddb3d56a31645d31345c7b3c222270d3b02ec0"
48
48
  }
@@ -371,11 +371,10 @@ export const assertProtocolV2ReconnectIdentity = (
371
371
  expectedSerialNumber?: string,
372
372
  actualSerialNumber?: string
373
373
  ) => {
374
+ // Some Pro2 loader builds omit serial_no. Reconnect still uses the same BLE
375
+ // descriptor or requires a uniquely enumerated USB device before this check.
374
376
  if (!expectedSerialNumber || !actualSerialNumber) {
375
- throw ERRORS.TypedError(
376
- HardwareErrorCode.DeviceNotFound,
377
- 'Protocol V2 reconnect physical identity is unavailable'
378
- );
377
+ return;
379
378
  }
380
379
  if (actualSerialNumber !== expectedSerialNumber) {
381
380
  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;