@onekeyfe/hd-shared 1.2.2-alpha.13 → 1.2.2-alpha.15

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.
@@ -87,7 +87,6 @@ export declare const HardwareErrorCode: {
87
87
  readonly BlePoweredOff: 721;
88
88
  readonly BleUnsupported: 722;
89
89
  readonly BleUnavailableWhileUsbConnected: 723;
90
- readonly BleBondInvalid: 724;
91
90
  readonly RuntimeError: 800;
92
91
  readonly PinInvalid: 801;
93
92
  readonly PinCancelled: 802;
@@ -1 +1 @@
1
- {"version":3,"file":"HardwareError.d.ts","sourceRoot":"","sources":["../src/HardwareError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,OAAO,CAAC,OAAO,iBAAiB,CAAC,CAAC;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,GAAG,CAAC;CACd;AAED,KAAK,OAAO,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAE5C,KAAK,+BAA+B,GAAG;KAAG,CAAC,IAAI,OAAO,CAAC,OAAO,iBAAiB,CAAC,GAAG,MAAM;CAAE,CAAC;AAE5F,KAAK,cAAc,GAAG,OAAO,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAsCxD,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAS,EAAE,cAAc,CAAkC;IAE3D,OAAO,SAAM;IAEb,MAAM,EAAE,GAAG,CAAM;gBAEL,aAAa,EAAE,cAAc,GAAG,MAAM;CAmBnD;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8bpB,CAAC;AAEX,eA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AAC;AAEF,QAAA,MAAM,sCAAsC;oBAM1B,MAAM;oBACN,MAAM;;;mBAcvB,CAAC;AAEF,QAAA,MAAM,yCAAyC,cAClC,MAAM,GAAG,SAAS,YACnB,MAAM,GAAG,SAAS,iBACb,CAAC,UAAU,GAAG,KAAK,CAAC,EAAE,oBACnB;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,kBAsBF,CAAC;AAEF,QAAA,MAAM,6BAA6B,mBACjB,MAAM,qBACH,MAAM,eACZ,MAAM,kBAQpB,CAAC;AAEF,QAAA,MAAM,4BAA4B,aACtB,MAAM,aACL,MAAM,cACL,MAAM,cACN,MAAM,aACP,MAAM,kBAWlB,CAAC;AAEF,QAAA,MAAM,iCAAiC,eAAgB,MAAM,gBAAgB,aAAa,kBAItF,CAAC;AAEL,OAAO,EACL,uCAAuC,EACvC,sCAAsC,EACtC,yCAAyC,EACzC,6BAA6B,EAC7B,4BAA4B,EAC5B,iCAAiC,GAClC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -361,11 +361,6 @@ declare const HardwareErrorCode: {
361
361
  readonly BlePoweredOff: 721;
362
362
  readonly BleUnsupported: 722;
363
363
  readonly BleUnavailableWhileUsbConnected: 723;
364
- /**
365
- * The host OS still has a stale BLE bond after the device pairing state was reset.
366
- * The user must forget the device in system Bluetooth settings and pair it again.
367
- */
368
- readonly BleBondInvalid: 724;
369
364
  /**
370
365
  * Hardware runtiome errors
371
366
  */
package/dist/index.js CHANGED
@@ -136,7 +136,6 @@ const HardwareErrorCode = {
136
136
  BlePoweredOff: 721,
137
137
  BleUnsupported: 722,
138
138
  BleUnavailableWhileUsbConnected: 723,
139
- BleBondInvalid: 724,
140
139
  RuntimeError: 800,
141
140
  PinInvalid: 801,
142
141
  PinCancelled: 802,
@@ -184,7 +183,7 @@ const HardwareErrorCodeMessage = {
184
183
  [HardwareErrorCode.DeviceInterruptedFromOutside]: 'Device interrupted',
185
184
  [HardwareErrorCode.DeviceInterruptedFromUser]: 'Device interrupted',
186
185
  [HardwareErrorCode.RequiredButInBootloaderMode]: 'Device should be in bootloader mode',
187
- [HardwareErrorCode.DeviceCheckDeviceIdError]: 'The connected device does not match this wallet. Reconnect the correct device, or add it again after a reset or recovery.',
186
+ [HardwareErrorCode.DeviceCheckDeviceIdError]: 'Device Id in the features is not same.',
188
187
  [HardwareErrorCode.DeviceNotSupportPassphrase]: 'Device not support passphrase',
189
188
  [HardwareErrorCode.DeviceCheckPassphraseStateError]: 'Device passphrase state error',
190
189
  [HardwareErrorCode.DeviceNotOpenedPassphrase]: 'Device not opened passphrase',
@@ -192,7 +191,7 @@ const HardwareErrorCodeMessage = {
192
191
  [HardwareErrorCode.DeviceDetectInBootloaderMode]: 'Device in bootloader mode',
193
192
  [HardwareErrorCode.NotAllowInBootloaderMode]: 'Device not allow in bootloader mode',
194
193
  [HardwareErrorCode.DeviceBusy]: 'Device is busy',
195
- [HardwareErrorCode.DeviceCheckUnlockTypeError]: 'The unlocked wallet does not match the selected wallet. Use the corresponding PIN or passphrase and try again.',
194
+ [HardwareErrorCode.DeviceCheckUnlockTypeError]: 'Device check unlock type not match error',
196
195
  [HardwareErrorCode.NotInitialized]: 'Not initialized',
197
196
  [HardwareErrorCode.IFrameNotInitialized]: 'IFrame not initialized',
198
197
  [HardwareErrorCode.IFrameAleradyInitialized]: 'IFrame alerady initialized',
@@ -245,7 +244,6 @@ const HardwareErrorCodeMessage = {
245
244
  [HardwareErrorCode.BlePoweredOff]: 'Bluetooth is turned off',
246
245
  [HardwareErrorCode.BleUnsupported]: 'Bluetooth is not supported on this device',
247
246
  [HardwareErrorCode.BleUnavailableWhileUsbConnected]: 'Bluetooth is unavailable while USB is connected. Unplug USB and try again.',
248
- [HardwareErrorCode.BleBondInvalid]: 'Bluetooth pairing information is no longer valid. Forget the device in system Bluetooth settings and pair it again.',
249
247
  [HardwareErrorCode.RuntimeError]: 'Runtime error',
250
248
  [HardwareErrorCode.PinInvalid]: 'Pin invalid',
251
249
  [HardwareErrorCode.PinCancelled]: 'Pin cancelled',
@@ -291,16 +289,13 @@ const TypedError = (hardwareError, message, params) => {
291
289
  const isBleStaleBondHardwareError = (error) => {
292
290
  const code = error === null || error === void 0 ? void 0 : error.errorCode;
293
291
  return (code === HardwareErrorCode.BleDeviceBondError ||
294
- code === HardwareErrorCode.BlePeerRemovedPairingInformation ||
295
- code === HardwareErrorCode.BleBondInvalid);
292
+ code === HardwareErrorCode.BlePeerRemovedPairingInformation);
296
293
  };
297
294
  const isBleStaleBondErrorText = (text) => {
298
295
  const value = text.toLowerCase();
299
296
  return (value.includes('encryption is insufficient') ||
300
297
  value.includes('insufficient encryption') ||
301
298
  value.includes('peer removed pairing information') ||
302
- value.includes('cberrordomain:14') ||
303
- value.includes('cbatterrordomain:14') ||
304
299
  value.includes('gatt_insuf_authentication'));
305
300
  };
306
301
  const serializeError = (payload) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-shared",
3
- "version": "1.2.2-alpha.13",
3
+ "version": "1.2.2-alpha.15",
4
4
  "description": "Hardware SDK's shared tool library",
5
5
  "keywords": [
6
6
  "Hardware-SDK",
@@ -26,5 +26,5 @@
26
26
  "lint": "eslint .",
27
27
  "lint:fix": "eslint . --fix"
28
28
  },
29
- "gitHead": "c901cdc6b474d015c7f50390fc5dc3db0ca4fbdb"
29
+ "gitHead": "ea66eff5817385ee2144d8e037c385342e44e21f"
30
30
  }
@@ -2,7 +2,6 @@ import {
2
2
  HardwareErrorCode,
3
3
  HardwareErrorCodeMessage,
4
4
  TypedError,
5
- isBleStaleBondErrorText,
6
5
  serializeError,
7
6
  } from './HardwareError';
8
7
 
@@ -13,15 +12,6 @@ describe('HardwareErrorCode compatibility', () => {
13
12
  expect(HardwareErrorCode.WalletSessionInvalid).toBe(831);
14
13
  });
15
14
 
16
- test('uses actionable wallet-context messages', () => {
17
- expect(HardwareErrorCodeMessage[HardwareErrorCode.DeviceCheckDeviceIdError]).toContain(
18
- 'does not match this wallet'
19
- );
20
- expect(HardwareErrorCodeMessage[HardwareErrorCode.DeviceCheckUnlockTypeError]).toContain(
21
- 'corresponding PIN or passphrase'
22
- );
23
- });
24
-
25
15
  test('reserves the BLE and USB conflict code for app error mapping', () => {
26
16
  expect(HardwareErrorCode.BleUnavailableWhileUsbConnected).toBe(723);
27
17
  expect(HardwareErrorCodeMessage[HardwareErrorCode.BleUnavailableWhileUsbConnected]).toBe(
@@ -43,21 +33,4 @@ describe('HardwareErrorCode compatibility', () => {
43
33
  },
44
34
  });
45
35
  });
46
-
47
- test('reserves a dedicated hd-core code for an invalid OS BLE bond', () => {
48
- expect(HardwareErrorCode.BleBondInvalid).toBe(724);
49
- expect(HardwareErrorCodeMessage[HardwareErrorCode.BleBondInvalid]).toContain(
50
- 'pairing information is no longer valid'
51
- );
52
- });
53
-
54
- test('recognizes the macOS CoreBluetooth stale-pairing error without matching generic failures', () => {
55
- expect(
56
- isBleStaleBondErrorText(
57
- 'CBErrorDomain:14 Peer removed pairing information on the device side'
58
- )
59
- ).toBe(true);
60
- expect(isBleStaleBondErrorText('CBATTErrorDomain:14 localized native message')).toBe(true);
61
- expect(isBleStaleBondErrorText('connection failed')).toBe(false);
62
- });
63
36
  });
@@ -346,11 +346,6 @@ export const HardwareErrorCode = {
346
346
  BlePoweredOff: 721,
347
347
  BleUnsupported: 722,
348
348
  BleUnavailableWhileUsbConnected: 723,
349
- /**
350
- * The host OS still has a stale BLE bond after the device pairing state was reset.
351
- * The user must forget the device in system Bluetooth settings and pair it again.
352
- */
353
- BleBondInvalid: 724,
354
349
 
355
350
  /**
356
351
  * Hardware runtiome errors
@@ -539,8 +534,7 @@ export const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping = {
539
534
  [HardwareErrorCode.DeviceInterruptedFromOutside]: 'Device interrupted',
540
535
  [HardwareErrorCode.DeviceInterruptedFromUser]: 'Device interrupted',
541
536
  [HardwareErrorCode.RequiredButInBootloaderMode]: 'Device should be in bootloader mode',
542
- [HardwareErrorCode.DeviceCheckDeviceIdError]:
543
- 'The connected device does not match this wallet. Reconnect the correct device, or add it again after a reset or recovery.',
537
+ [HardwareErrorCode.DeviceCheckDeviceIdError]: 'Device Id in the features is not same.',
544
538
  [HardwareErrorCode.DeviceNotSupportPassphrase]: 'Device not support passphrase',
545
539
  [HardwareErrorCode.DeviceCheckPassphraseStateError]: 'Device passphrase state error',
546
540
  [HardwareErrorCode.DeviceNotOpenedPassphrase]: 'Device not opened passphrase',
@@ -548,8 +542,7 @@ export const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping = {
548
542
  [HardwareErrorCode.DeviceDetectInBootloaderMode]: 'Device in bootloader mode',
549
543
  [HardwareErrorCode.NotAllowInBootloaderMode]: 'Device not allow in bootloader mode',
550
544
  [HardwareErrorCode.DeviceBusy]: 'Device is busy',
551
- [HardwareErrorCode.DeviceCheckUnlockTypeError]:
552
- 'The unlocked wallet does not match the selected wallet. Use the corresponding PIN or passphrase and try again.',
545
+ [HardwareErrorCode.DeviceCheckUnlockTypeError]: 'Device check unlock type not match error',
553
546
  /**
554
547
  * Node Errors
555
548
  */
@@ -629,8 +622,6 @@ export const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping = {
629
622
  [HardwareErrorCode.BleUnsupported]: 'Bluetooth is not supported on this device',
630
623
  [HardwareErrorCode.BleUnavailableWhileUsbConnected]:
631
624
  'Bluetooth is unavailable while USB is connected. Unplug USB and try again.',
632
- [HardwareErrorCode.BleBondInvalid]:
633
- 'Bluetooth pairing information is no longer valid. Forget the device in system Bluetooth settings and pair it again.',
634
625
 
635
626
  /**
636
627
  * Runtime Error
@@ -669,6 +660,7 @@ export const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping = {
669
660
  [HardwareErrorCode.WalletSessionInvalid]: 'Wallet session is invalid or expired',
670
661
  [HardwareErrorCode.NftStorageLimitReached]:
671
662
  'NFT storage limit reached. Remove an NFT from the device and try again.',
663
+
672
664
  /**
673
665
  * Lowlevel transport
674
666
  */
@@ -694,8 +686,7 @@ export const isBleStaleBondHardwareError = (error: unknown): boolean => {
694
686
  const code = (error as { errorCode?: unknown })?.errorCode;
695
687
  return (
696
688
  code === HardwareErrorCode.BleDeviceBondError ||
697
- code === HardwareErrorCode.BlePeerRemovedPairingInformation ||
698
- code === HardwareErrorCode.BleBondInvalid
689
+ code === HardwareErrorCode.BlePeerRemovedPairingInformation
699
690
  );
700
691
  };
701
692
 
@@ -705,8 +696,6 @@ export const isBleStaleBondErrorText = (text: string): boolean => {
705
696
  value.includes('encryption is insufficient') ||
706
697
  value.includes('insufficient encryption') ||
707
698
  value.includes('peer removed pairing information') ||
708
- value.includes('cberrordomain:14') ||
709
- value.includes('cbatterrordomain:14') ||
710
699
  value.includes('gatt_insuf_authentication')
711
700
  );
712
701
  };