@onekeyfe/hd-core 1.2.0-alpha.122 → 1.2.0-alpha.124

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.
@@ -172,6 +172,15 @@ describe('DeviceStateMapper', () => {
172
172
  });
173
173
  });
174
174
 
175
+ test('removes a truncated Find My suffix from the Protocol V2 BLE name', () => {
176
+ const patch = mapProtocolV2DeviceInfoToState({
177
+ hw: { Device_type: DeviceType.PRO2, serial_no: 'SERIAL-1' },
178
+ coprocessor: { bt_adv_name: 'Pro2 22D8 - Fin' },
179
+ });
180
+
181
+ expect(patch.identity?.bleName).toBe('Pro2 22D8');
182
+ });
183
+
175
184
  test('maps the hardware model independently from Protocol V2', () => {
176
185
  const pro = mapProtocolV2DeviceInfoToState({
177
186
  protocol_version: 2,
@@ -111,6 +111,7 @@ describe('SearchDevices', () => {
111
111
  test.each([
112
112
  ['OneKey Pro', 'pro'],
113
113
  ['OneKey Pro 2', 'pro2'],
114
+ ['Neo A1B2', 'neo'],
114
115
  ])(
115
116
  'BLE discovery keeps the %s transport identity separate from device identity',
116
117
  async (name, deviceType) => {
@@ -148,4 +149,43 @@ describe('SearchDevices', () => {
148
149
  expect(mockGetDevices).not.toHaveBeenCalled();
149
150
  }
150
151
  );
152
+
153
+ test.each([
154
+ ['Pro2 A1B2 - Find My', undefined, 'Pro2 A1B2'],
155
+ ['Pro2 5E9D - Finde My', undefined, 'Pro2 5E9D'],
156
+ ['Pro2 22D8FindMy', undefined, 'Pro2 22D8'],
157
+ [undefined, 'OneKey Pro 2 A1B2 - Find My', 'OneKey Pro 2 A1B2'],
158
+ ])(
159
+ 'BLE discovery normalizes the Find My display name from name=%s localName=%s',
160
+ async (name, localName, expectedName) => {
161
+ mockIsBleConnect.mockReturnValue(true);
162
+
163
+ const method = new SearchDevices({
164
+ id: 1,
165
+ payload: { method: 'searchDevices' },
166
+ } as any);
167
+ method.init();
168
+ method.connector = {
169
+ enumerate: jest.fn().mockResolvedValue({
170
+ descriptors: [
171
+ {
172
+ id: 'ble-peripheral-id',
173
+ path: 'ble-peripheral-id',
174
+ name,
175
+ localName,
176
+ commType: 'ble',
177
+ },
178
+ ],
179
+ }),
180
+ } as any;
181
+
182
+ await expect(method.run()).resolves.toEqual([
183
+ expect.objectContaining({
184
+ connectId: 'ble-peripheral-id',
185
+ name: expectedName,
186
+ deviceType: 'pro2',
187
+ }),
188
+ ]);
189
+ }
190
+ );
151
191
  });
@@ -1 +1 @@
1
- {"version":3,"file":"SearchDevices.d.ts","sourceRoot":"","sources":["../../src/api/SearchDevices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM1C,OAAO,KAAK,eAAe,MAAM,2BAA2B,CAAC;AAI7D,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU;IACnD,SAAS,CAAC,EAAE,eAAe,CAAC;IAE5B,IAAI;IAME,GAAG;;;;;;;;;;;;;;;CA8DV"}
1
+ {"version":3,"file":"SearchDevices.d.ts","sourceRoot":"","sources":["../../src/api/SearchDevices.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM1C,OAAO,KAAK,eAAe,MAAM,2BAA2B,CAAC;AAI7D,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU;IACnD,SAAS,CAAC,EAAE,eAAe,CAAC;IAE5B,IAAI;IAME,GAAG;;;;;;;;;;;;;;;CA+DV"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AACA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAgClC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAsB1C,OAAO,eAAe,MAAM,2BAA2B,CAAC;AAYxD,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;AAmE7D,eAAO,MAAM,OAAO,YAAmB,WAAW,WAAW,WAAW,iBAoFvE,CAAC;AA+3BF,eAAO,MAAM,MAAM,YAAa,WAAW,cAAc,MAAM,SAkF9D,CAAC;AAmGF,eAAO,MAAM,qBAAqB,gFAejC,CAAC;AAiLF,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,8BAiBvC,CAAC;AAEF,eAAO,MAAM,eAAe;SAKrB,eAAe,CAAC,KAAK,CAAC;eAChB,GAAG;;UASf,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AACA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAoClC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAsB1C,OAAO,eAAe,MAAM,2BAA2B,CAAC;AAYxD,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;AAmE7D,eAAO,MAAM,OAAO,YAAmB,WAAW,WAAW,WAAW,iBAoFvE,CAAC;AAw4BF,eAAO,MAAM,MAAM,YAAa,WAAW,cAAc,MAAM,SAkF9D,CAAC;AAmGF,eAAO,MAAM,qBAAqB,gFAejC,CAAC;AAiLF,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,8BAiBvC,CAAC;AAEF,eAAO,MAAM,eAAe;SAKrB,eAAe,CAAC,KAAK,CAAC;eAChB,GAAG;;UASf,CAAC"}
@@ -31,7 +31,7 @@ export declare const cancelDeviceInPrompt: (device: Device, expectResponse?: boo
31
31
  };
32
32
  } | {
33
33
  success: boolean;
34
- error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902;
34
+ error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902;
35
35
  payload: {
36
36
  message: string;
37
37
  };
@@ -50,7 +50,7 @@ export declare const cancelDeviceWithInitialize: (device: Device) => Promise<{
50
50
  };
51
51
  } | {
52
52
  success: boolean;
53
- error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902;
53
+ error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902;
54
54
  payload: {
55
55
  message: string;
56
56
  };
@@ -80,7 +80,7 @@ export declare class DeviceCommands {
80
80
  };
81
81
  } | {
82
82
  success: boolean;
83
- error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902;
83
+ error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902;
84
84
  payload: {
85
85
  message: string;
86
86
  };
@@ -99,7 +99,7 @@ export declare class DeviceCommands {
99
99
  };
100
100
  } | {
101
101
  success: boolean;
102
- error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902;
102
+ error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902;
103
103
  payload: {
104
104
  message: string;
105
105
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DeviceStateMapper.d.ts","sourceRoot":"","sources":["../../src/device/DeviceStateMapper.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,aAAa,EAEb,cAAc,EACd,YAAY,EACZ,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAEV,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,cAAc,EACf,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAsDxE,eAAO,MAAM,kBAAkB,aAAc,QAAQ,KAAG,gBAqEtD,CAAC;AAEH,eAAO,MAAM,4BAA4B,uBACnB,cAAc,KACjC,gBAA0F,CAAC;AAc9F,eAAO,MAAM,kCAAkC,aAAc,cAAc,KAAG,gBAgE7E,CAAC;AAEF,eAAO,MAAM,8BAA8B,SACnC,oBAAoB,SACpB,eAAe,KACpB,gBAqGF,CAAC;AAEF,eAAO,MAAM,gCAAgC,WAAY,YAAY,KAAG,gBAYtE,CAAC;AAEH,eAAO,MAAM,uBAAuB,aAAc,aAAa,KAAG,gBAmBjE,CAAC;AAEF,eAAO,MAAM,wBAAwB,aAAc,cAAc,KAAG,gBAwBnE,CAAC;AAEF,eAAO,MAAM,6BAA6B,aAAc,oBAAoB,KAAG,cAe3E,CAAC"}
1
+ {"version":3,"file":"DeviceStateMapper.d.ts","sourceRoot":"","sources":["../../src/device/DeviceStateMapper.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,aAAa,EAEb,cAAc,EACd,YAAY,EACZ,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAEV,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,cAAc,EACf,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAsDxE,eAAO,MAAM,kBAAkB,aAAc,QAAQ,KAAG,gBAqEtD,CAAC;AAEH,eAAO,MAAM,4BAA4B,uBACnB,cAAc,KACjC,gBAA0F,CAAC;AAc9F,eAAO,MAAM,kCAAkC,aAAc,cAAc,KAAG,gBAgE7E,CAAC;AAEF,eAAO,MAAM,8BAA8B,SACnC,oBAAoB,SACpB,eAAe,KACpB,gBAuGF,CAAC;AAEF,eAAO,MAAM,gCAAgC,WAAY,YAAY,KAAG,gBAYtE,CAAC;AAEH,eAAO,MAAM,uBAAuB,aAAc,aAAa,KAAG,gBAmBjE,CAAC;AAEF,eAAO,MAAM,wBAAwB,aAAc,cAAc,KAAG,gBAwBnE,CAAC;AAEF,eAAO,MAAM,6BAA6B,aAAc,oBAAoB,KAAG,cAe3E,CAAC"}
package/dist/index.d.ts CHANGED
@@ -136,7 +136,7 @@ declare class DeviceCommands {
136
136
  };
137
137
  } | {
138
138
  success: boolean;
139
- error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902;
139
+ error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902;
140
140
  payload: {
141
141
  message: string;
142
142
  };
@@ -155,7 +155,7 @@ declare class DeviceCommands {
155
155
  };
156
156
  } | {
157
157
  success: boolean;
158
- error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902;
158
+ error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902;
159
159
  payload: {
160
160
  message: string;
161
161
  };
package/dist/index.js CHANGED
@@ -38004,7 +38004,7 @@ var nested = {
38004
38004
  type: "bytes",
38005
38005
  id: 1
38006
38006
  },
38007
- signning_message: {
38007
+ signing_message: {
38008
38008
  type: "bytes",
38009
38009
  id: 2
38010
38010
  },
@@ -44515,7 +44515,9 @@ const mapProtocolV2DeviceInfoToState = (info, mode = 'unknown') => {
44515
44515
  model: identity.model,
44516
44516
  vendor: 'onekey.so',
44517
44517
  serialNo: (_b = info.hw) === null || _b === void 0 ? void 0 : _b.serial_no,
44518
- bleName: (_c = info.coprocessor) === null || _c === void 0 ? void 0 : _c.bt_adv_name,
44518
+ bleName: ((_c = info.coprocessor) === null || _c === void 0 ? void 0 : _c.bt_adv_name)
44519
+ ? hdShared.normalizePro2FindMyAdvertisementName(info.coprocessor.bt_adv_name)
44520
+ : undefined,
44519
44521
  deviceId: loader ? null : undefined,
44520
44522
  }),
44521
44523
  status: loader
@@ -46816,7 +46818,8 @@ class SearchDevices extends BaseMethod {
46816
46818
  const lowerId = (_c = device.id) === null || _c === void 0 ? void 0 : _c.toLowerCase();
46817
46819
  if (!seenIds.has(lowerId)) {
46818
46820
  seenIds.add(lowerId);
46819
- const bleName = (_e = (_d = device.name) !== null && _d !== void 0 ? _d : device.localName) !== null && _e !== void 0 ? _e : '';
46821
+ const rawBleName = (_e = (_d = device.name) !== null && _d !== void 0 ? _d : device.localName) !== null && _e !== void 0 ? _e : '';
46822
+ const bleName = hdShared.normalizePro2FindMyAdvertisementName(rawBleName);
46820
46823
  devices.push(Object.assign(Object.assign({}, device), { connectId: device.id, serialNo: null, uuid: '', deviceId: null, name: bleName || device.name, deviceType: getDeviceTypeByBleName(bleName) }));
46821
46824
  }
46822
46825
  }
@@ -65669,6 +65672,13 @@ const ensureConnected = (_context, method, connectId, pollingId, abortSignal) =>
65669
65672
  }
65670
65673
  catch (error) {
65671
65674
  Log.debug('device error: ', error);
65675
+ if (hdTransport.isProtocolV2LinkDisabledError(error)) {
65676
+ reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleUnavailableWhileUsbConnected, undefined, {
65677
+ failureCode: error.failureCode,
65678
+ firmwareMessage: error.firmwareMessage,
65679
+ }));
65680
+ return;
65681
+ }
65672
65682
  if ([hdShared.HardwareErrorCode.BleCharacteristicNotifyChangeFailure].includes(error.errorCode)) {
65673
65683
  postMessage(createUiMessage(UI_REQUEST.BLUETOOTH_CHARACTERISTIC_NOTIFY_CHANGE_FAILURE));
65674
65684
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "1.2.0-alpha.122",
3
+ "version": "1.2.0-alpha.124",
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.122",
29
- "@onekeyfe/hd-transport": "1.2.0-alpha.122",
28
+ "@onekeyfe/hd-shared": "1.2.0-alpha.124",
29
+ "@onekeyfe/hd-transport": "1.2.0-alpha.124",
30
30
  "axios": "1.15.2",
31
31
  "bignumber.js": "^9.0.2",
32
32
  "buffer": "^6.0.3",
@@ -46,5 +46,5 @@
46
46
  "@types/w3c-web-usb": "^1.0.10",
47
47
  "@types/web-bluetooth": "^0.0.21"
48
48
  },
49
- "gitHead": "f0a85119fe7f8607768bc77b0ac4eb527d55e1cc"
49
+ "gitHead": "939229b4fe0dd7939b6fa3b2f6801f4e6b055c3b"
50
50
  }
@@ -1,3 +1,5 @@
1
+ import { normalizePro2FindMyAdvertisementName } from '@onekeyfe/hd-shared';
2
+
1
3
  import { BaseMethod } from './BaseMethod';
2
4
  import TransportManager from '../data-manager/TransportManager';
3
5
  import { DataManager } from '../data-manager';
@@ -36,8 +38,9 @@ export default class SearchDevices extends BaseMethod {
36
38
  const lowerId = device.id?.toLowerCase();
37
39
  if (!seenIds.has(lowerId)) {
38
40
  seenIds.add(lowerId);
39
- const bleName =
41
+ const rawBleName =
40
42
  device.name ?? (device as unknown as { localName?: string }).localName ?? '';
43
+ const bleName = normalizePro2FindMyAdvertisementName(rawBleName);
41
44
  devices.push({
42
45
  ...device,
43
46
  connectId: device.id,
package/src/core/index.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  import semver from 'semver';
2
2
  import EventEmitter from 'events';
3
- import { DeviceSessionPinType, TRANSPORT_EVENT } from '@onekeyfe/hd-transport';
3
+ import {
4
+ DeviceSessionPinType,
5
+ TRANSPORT_EVENT,
6
+ isProtocolV2LinkDisabledError,
7
+ } from '@onekeyfe/hd-transport';
4
8
  import {
5
9
  ERRORS,
6
10
  ERROR_CODES_REQUIRE_DISCONNECT,
@@ -1075,6 +1079,15 @@ const ensureConnected = async (
1075
1079
  }
1076
1080
  } catch (error) {
1077
1081
  Log.debug('device error: ', error);
1082
+ if (isProtocolV2LinkDisabledError(error)) {
1083
+ reject(
1084
+ ERRORS.TypedError(HardwareErrorCode.BleUnavailableWhileUsbConnected, undefined, {
1085
+ failureCode: error.failureCode,
1086
+ firmwareMessage: error.firmwareMessage,
1087
+ })
1088
+ );
1089
+ return;
1090
+ }
1078
1091
  if ([HardwareErrorCode.BleCharacteristicNotifyChangeFailure].includes(error.errorCode)) {
1079
1092
  postMessage(createUiMessage(UI_REQUEST.BLUETOOTH_CHARACTERISTIC_NOTIFY_CHANGE_FAILURE));
1080
1093
  }
@@ -10925,7 +10925,7 @@
10925
10925
  "type": "bytes",
10926
10926
  "id": 1
10927
10927
  },
10928
- "signning_message": {
10928
+ "signing_message": {
10929
10929
  "type": "bytes",
10930
10930
  "id": 2
10931
10931
  },
@@ -1,4 +1,4 @@
1
- import { EFirmwareType } from '@onekeyfe/hd-shared';
1
+ import { EFirmwareType, normalizePro2FindMyAdvertisementName } from '@onekeyfe/hd-shared';
2
2
 
3
3
  import { buildProtocolV1FeaturesPayload } from '../deviceProfile/buildDeviceFeatures';
4
4
  import { resolveProtocolV2DeviceIdentity } from '../deviceProfile/protocolV2DeviceIdentity';
@@ -247,7 +247,9 @@ export const mapProtocolV2DeviceInfoToState = (
247
247
  model: identity.model,
248
248
  vendor: 'onekey.so',
249
249
  serialNo: info.hw?.serial_no,
250
- bleName: info.coprocessor?.bt_adv_name,
250
+ bleName: info.coprocessor?.bt_adv_name
251
+ ? normalizePro2FindMyAdvertisementName(info.coprocessor.bt_adv_name)
252
+ : undefined,
251
253
  deviceId: loader ? null : undefined,
252
254
  }),
253
255
  status: loader