@onekeyfe/hd-shared 1.2.2-alpha.100 → 1.2.2-alpha.12

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.
@@ -125,6 +125,8 @@ export declare const HardwareErrorCode: {
125
125
  };
126
126
  export declare const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping;
127
127
  export declare const TypedError: (hardwareError: ErrorCodeUnion | string, message?: string, params?: any) => HardwareError;
128
+ export declare const isBleStaleBondHardwareError: (error: unknown) => boolean;
129
+ export declare const isBleStaleBondErrorText: (text: string) => boolean;
128
130
  export declare const serializeError: (payload: any) => any;
129
131
  export declare const CreateErrorByMessage: (message: string) => HardwareError;
130
132
  export declare const CreateHardwareErrorByBridgeError: (raw: string) => HardwareError;
@@ -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;;;;;;;;;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BACN,MAAM;;;mBAcvB,CAAC;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"}
@@ -77,6 +77,7 @@ export declare const normalizePro2FindMyAdvertisementName: (value: string) => st
77
77
  export declare const canonicalizePro2BleAdvertisementName: (value: string) => string;
78
78
  export declare const isSameOnekeyBleName: (left?: string | null, right?: string | null) => boolean;
79
79
  export declare const hasOnekeyCommunicationService: (serviceUuids: Array<string | null | undefined> | null | undefined) => boolean;
80
+ export declare const isPro2FamilyBleName: (value?: string | null) => boolean;
80
81
  export declare const isOnekeyBluetoothDevice: ({ id, name, localName, serviceUuids, }: BluetoothDeviceIdentity) => boolean;
81
82
  export {};
82
83
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,yBAAyB;;;CAG5B,CAAC;AAEX,MAAM,MAAM,uBAAuB,GACjC,CAAC,OAAO,yBAAyB,CAAC,CAAC,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MAAM,CAc1E,CAAC;AAEF,eAAO,MAAM,mBAAmB,eAClB,MAAM,GAAG,IAAI,GAAG,SAAS,WAC5B,YAAY,MAAM,CAAC,YACgB,CAAC;AAmC/C,eAAO,MAAM,6BAA6B,WAAY,MAAM,GAAG,IAAI,YAWlE,CAAC;AAEF,eAAO,MAAM,oCAAoC,UAAW,MAAM,WAejE,CAAC;AAUF,eAAO,MAAM,oCAAoC,UAAW,MAAM,WAWjE,CAAC;AAEF,eAAO,MAAM,mBAAmB,UAAW,MAAM,GAAG,IAAI,UAAU,MAAM,GAAG,IAAI,YAO9E,CAAC;AAEF,eAAO,MAAM,6BAA6B,iBAC1B,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,IAAI,GAAG,SAAS,YAIhE,CAAC;AAOJ,eAAO,MAAM,mBAAmB,WAAY,MAAM,GAAG,IAAI,KAAG,OAiB3D,CAAC;AAEF,eAAO,MAAM,uBAAuB,2CAKjC,uBAAuB,KAAG,OAiB5B,CAAC"}
package/dist/index.d.ts CHANGED
@@ -103,6 +103,12 @@ declare const normalizePro2FindMyAdvertisementName: (value: string) => string;
103
103
  declare const canonicalizePro2BleAdvertisementName: (value: string) => string;
104
104
  declare const isSameOnekeyBleName: (left?: string | null, right?: string | null) => boolean;
105
105
  declare const hasOnekeyCommunicationService: (serviceUuids: Array<string | null | undefined> | null | undefined) => boolean;
106
+ /**
107
+ * Protocol V2 family (Pro2 / Neo) by advertised BLE name. Callers use it to
108
+ * pick a connection strategy: this family also advertises under Find My names
109
+ * that carry no OneKey service UUID, so a scan cannot always see it.
110
+ */
111
+ declare const isPro2FamilyBleName: (value?: string | null) => boolean;
106
112
  declare const isOnekeyBluetoothDevice: ({ id, name, localName, serviceUuids, }: BluetoothDeviceIdentity) => boolean;
107
113
 
108
114
  type Deferred<T, I = any, D = any> = {
@@ -497,6 +503,8 @@ declare const HardwareErrorCode: {
497
503
  };
498
504
  declare const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping;
499
505
  declare const TypedError: (hardwareError: ErrorCodeUnion | string, message?: string, params?: any) => HardwareError;
506
+ declare const isBleStaleBondHardwareError: (error: unknown) => boolean;
507
+ declare const isBleStaleBondErrorText: (text: string) => boolean;
500
508
  declare const serializeError: (payload: any) => any;
501
509
  declare const CreateErrorByMessage: (message: string) => HardwareError;
502
510
  declare const CreateHardwareErrorByBridgeError: (raw: string) => HardwareError;
@@ -532,6 +540,8 @@ declare const HardwareError$1_HardwareError: typeof HardwareError;
532
540
  declare const HardwareError$1_HardwareErrorCode: typeof HardwareErrorCode;
533
541
  declare const HardwareError$1_HardwareErrorCodeMessage: typeof HardwareErrorCodeMessage;
534
542
  declare const HardwareError$1_TypedError: typeof TypedError;
543
+ declare const HardwareError$1_isBleStaleBondHardwareError: typeof isBleStaleBondHardwareError;
544
+ declare const HardwareError$1_isBleStaleBondErrorText: typeof isBleStaleBondErrorText;
535
545
  declare const HardwareError$1_serializeError: typeof serializeError;
536
546
  declare const HardwareError$1_CreateErrorByMessage: typeof CreateErrorByMessage;
537
547
  declare const HardwareError$1_CreateHardwareErrorByBridgeError: typeof CreateHardwareErrorByBridgeError;
@@ -548,6 +558,8 @@ declare namespace HardwareError$1 {
548
558
  HardwareError$1_HardwareErrorCode as HardwareErrorCode,
549
559
  HardwareError$1_HardwareErrorCodeMessage as HardwareErrorCodeMessage,
550
560
  HardwareError$1_TypedError as TypedError,
561
+ HardwareError$1_isBleStaleBondHardwareError as isBleStaleBondHardwareError,
562
+ HardwareError$1_isBleStaleBondErrorText as isBleStaleBondErrorText,
551
563
  HardwareError$1_serializeError as serializeError,
552
564
  HardwareError$1_CreateErrorByMessage as CreateErrorByMessage,
553
565
  HardwareError$1_CreateHardwareErrorByBridgeError as CreateHardwareErrorByBridgeError,
@@ -568,4 +580,4 @@ declare enum EDeviceType {
568
580
  Neo = "neo"
569
581
  }
570
582
 
571
- export { CreateErrorByMessage, CreateHardwareErrorByBridgeError, Deferred, EBleDisconnectReason, EDeviceType, EFirmwareType, EOneKeyBleMessageKeys, HardwareError$1 as ERRORS, ERROR_CODES_REQUIRE_DISCONNECT, ERROR_CODES_REQUIRE_RELEASE, HARDWARE_CONNECT_PROTOCOL, HardwareConnectProtocol, HardwareError, HardwareErrorCode, HardwareErrorCodeMessage, IHardwareError, ONEKEY_NOTIFY_CHARACTERISTIC_UUID, ONEKEY_PROTOCOL_V2_USB_IDS, ONEKEY_SERVICE_UUID, ONEKEY_WEBUSB_FILTER, ONEKEY_WRITE_CHARACTERISTIC_UUID, TypedError, canonicalizePro2BleAdvertisementName, createDefectiveFirmwareError, createDeferred, createDeprecatedHardwareError, createDeviceNotSupportMethodError, createKnownBleUuidAliases, createNeedUpgradeFirmwareHardwareError, createNewFirmwareForceUpdateHardwareError, createNewFirmwareUnReleaseHardwareError, hasOnekeyCommunicationService, inferProtocolHintFromUsbId, isHeaderChunk, isKnownTrezorWebUsbDevice, isOnekeyBluetoothDevice, isOnekeyDevice, isPro2FindMyAdvertisementName, isSameOnekeyBleName, matchesKnownBleUuid, normalizeBleUuid, normalizePro2FindMyAdvertisementName, resolveOneKeyUsbDevicePath, serializeError, wait };
583
+ export { CreateErrorByMessage, CreateHardwareErrorByBridgeError, Deferred, EBleDisconnectReason, EDeviceType, EFirmwareType, EOneKeyBleMessageKeys, HardwareError$1 as ERRORS, ERROR_CODES_REQUIRE_DISCONNECT, ERROR_CODES_REQUIRE_RELEASE, HARDWARE_CONNECT_PROTOCOL, HardwareConnectProtocol, HardwareError, HardwareErrorCode, HardwareErrorCodeMessage, IHardwareError, ONEKEY_NOTIFY_CHARACTERISTIC_UUID, ONEKEY_PROTOCOL_V2_USB_IDS, ONEKEY_SERVICE_UUID, ONEKEY_WEBUSB_FILTER, ONEKEY_WRITE_CHARACTERISTIC_UUID, TypedError, canonicalizePro2BleAdvertisementName, createDefectiveFirmwareError, createDeferred, createDeprecatedHardwareError, createDeviceNotSupportMethodError, createKnownBleUuidAliases, createNeedUpgradeFirmwareHardwareError, createNewFirmwareForceUpdateHardwareError, createNewFirmwareUnReleaseHardwareError, hasOnekeyCommunicationService, inferProtocolHintFromUsbId, isBleStaleBondErrorText, isBleStaleBondHardwareError, isHeaderChunk, isKnownTrezorWebUsbDevice, isOnekeyBluetoothDevice, isOnekeyDevice, isPro2FamilyBleName, isPro2FindMyAdvertisementName, isSameOnekeyBleName, matchesKnownBleUuid, normalizeBleUuid, normalizePro2FindMyAdvertisementName, resolveOneKeyUsbDevicePath, serializeError, wait };
package/dist/index.js CHANGED
@@ -183,7 +183,7 @@ const HardwareErrorCodeMessage = {
183
183
  [HardwareErrorCode.DeviceInterruptedFromOutside]: 'Device interrupted',
184
184
  [HardwareErrorCode.DeviceInterruptedFromUser]: 'Device interrupted',
185
185
  [HardwareErrorCode.RequiredButInBootloaderMode]: 'Device should be in bootloader mode',
186
- [HardwareErrorCode.DeviceCheckDeviceIdError]: 'Device Id in the features is not same.',
186
+ [HardwareErrorCode.DeviceCheckDeviceIdError]: 'The connected device does not match this wallet. Reconnect the correct device, or add it again after a reset or recovery.',
187
187
  [HardwareErrorCode.DeviceNotSupportPassphrase]: 'Device not support passphrase',
188
188
  [HardwareErrorCode.DeviceCheckPassphraseStateError]: 'Device passphrase state error',
189
189
  [HardwareErrorCode.DeviceNotOpenedPassphrase]: 'Device not opened passphrase',
@@ -191,7 +191,7 @@ const HardwareErrorCodeMessage = {
191
191
  [HardwareErrorCode.DeviceDetectInBootloaderMode]: 'Device in bootloader mode',
192
192
  [HardwareErrorCode.NotAllowInBootloaderMode]: 'Device not allow in bootloader mode',
193
193
  [HardwareErrorCode.DeviceBusy]: 'Device is busy',
194
- [HardwareErrorCode.DeviceCheckUnlockTypeError]: 'Device check unlock type not match error',
194
+ [HardwareErrorCode.DeviceCheckUnlockTypeError]: 'The unlocked wallet does not match the selected wallet. Use the corresponding PIN or passphrase and try again.',
195
195
  [HardwareErrorCode.NotInitialized]: 'Not initialized',
196
196
  [HardwareErrorCode.IFrameNotInitialized]: 'IFrame not initialized',
197
197
  [HardwareErrorCode.IFrameAleradyInitialized]: 'IFrame alerady initialized',
@@ -286,6 +286,19 @@ const TypedError = (hardwareError, message, params) => {
286
286
  }
287
287
  return new HardwareError({ errorCode: hardwareError, message: message !== null && message !== void 0 ? message : '', params });
288
288
  };
289
+ const isBleStaleBondHardwareError = (error) => {
290
+ const code = error === null || error === void 0 ? void 0 : error.errorCode;
291
+ return (code === HardwareErrorCode.BleDeviceBondError ||
292
+ code === HardwareErrorCode.BlePeerRemovedPairingInformation);
293
+ };
294
+ const isBleStaleBondErrorText = (text) => {
295
+ const value = text.toLowerCase();
296
+ return (value.includes('encryption is insufficient') ||
297
+ value.includes('insufficient encryption') ||
298
+ value.includes('peer removed pairing information') ||
299
+ value.includes('cberrordomain:14') ||
300
+ value.includes('gatt_insuf_authentication'));
301
+ };
289
302
  const serializeError = (payload) => {
290
303
  if (payload && payload.error instanceof HardwareError) {
291
304
  return {
@@ -377,6 +390,8 @@ var HardwareError$1 = /*#__PURE__*/Object.freeze({
377
390
  HardwareErrorCode: HardwareErrorCode,
378
391
  HardwareErrorCodeMessage: HardwareErrorCodeMessage,
379
392
  TypedError: TypedError,
393
+ isBleStaleBondHardwareError: isBleStaleBondHardwareError,
394
+ isBleStaleBondErrorText: isBleStaleBondErrorText,
380
395
  serializeError: serializeError,
381
396
  CreateErrorByMessage: CreateErrorByMessage,
382
397
  CreateHardwareErrorByBridgeError: CreateHardwareErrorByBridgeError,
@@ -622,6 +637,22 @@ const isSameOnekeyBleName = (left, right) => {
622
637
  compactBleName(canonicalizePro2BleAdvertisementName(right)));
623
638
  };
624
639
  const hasOnekeyCommunicationService = (serviceUuids) => (serviceUuids !== null && serviceUuids !== void 0 ? serviceUuids : []).some(uuid => matchesKnownBleUuid(uuid, ONEKEY_COMMUNICATION_SERVICE_ALIASES));
640
+ const isPro2FamilyBleName = (value) => {
641
+ if (!value) {
642
+ return false;
643
+ }
644
+ const normalized = value.trim().toLowerCase();
645
+ if (!normalized) {
646
+ return false;
647
+ }
648
+ if (normalized.startsWith('pro2') || normalized.startsWith('neo')) {
649
+ return true;
650
+ }
651
+ const compact = compactBleName(normalized);
652
+ return (PRO2_COMPACT_NAME_PATTERN.test(compact) ||
653
+ NEO_COMPACT_NAME_PATTERN.test(compact) ||
654
+ isPro2FindMyAdvertisementName(value));
655
+ };
625
656
  const isOnekeyBluetoothDevice = ({ id, name, localName, serviceUuids, }) => {
626
657
  const advertisedServiceUuids = serviceUuids !== null && serviceUuids !== void 0 ? serviceUuids : [];
627
658
  if (hasOnekeyCommunicationService(advertisedServiceUuids)) {
@@ -736,10 +767,13 @@ exports.createNewFirmwareForceUpdateHardwareError = createNewFirmwareForceUpdate
736
767
  exports.createNewFirmwareUnReleaseHardwareError = createNewFirmwareUnReleaseHardwareError;
737
768
  exports.hasOnekeyCommunicationService = hasOnekeyCommunicationService;
738
769
  exports.inferProtocolHintFromUsbId = inferProtocolHintFromUsbId;
770
+ exports.isBleStaleBondErrorText = isBleStaleBondErrorText;
771
+ exports.isBleStaleBondHardwareError = isBleStaleBondHardwareError;
739
772
  exports.isHeaderChunk = isHeaderChunk;
740
773
  exports.isKnownTrezorWebUsbDevice = isKnownTrezorWebUsbDevice;
741
774
  exports.isOnekeyBluetoothDevice = isOnekeyBluetoothDevice;
742
775
  exports.isOnekeyDevice = isOnekeyDevice;
776
+ exports.isPro2FamilyBleName = isPro2FamilyBleName;
743
777
  exports.isPro2FindMyAdvertisementName = isPro2FindMyAdvertisementName;
744
778
  exports.isSameOnekeyBleName = isSameOnekeyBleName;
745
779
  exports.matchesKnownBleUuid = matchesKnownBleUuid;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-shared",
3
- "version": "1.2.2-alpha.100",
3
+ "version": "1.2.2-alpha.12",
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": "c40dad085297b0e3cc2020bd218c146dff6ed3e1"
29
+ "gitHead": "9b5a45bc55819d22ed752899b4c40aad70de4527"
30
30
  }
@@ -2,6 +2,7 @@ import {
2
2
  HardwareErrorCode,
3
3
  HardwareErrorCodeMessage,
4
4
  TypedError,
5
+ isBleStaleBondErrorText,
5
6
  serializeError,
6
7
  } from './HardwareError';
7
8
 
@@ -12,6 +13,15 @@ describe('HardwareErrorCode compatibility', () => {
12
13
  expect(HardwareErrorCode.WalletSessionInvalid).toBe(831);
13
14
  });
14
15
 
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
+
15
25
  test('reserves the BLE and USB conflict code for app error mapping', () => {
16
26
  expect(HardwareErrorCode.BleUnavailableWhileUsbConnected).toBe(723);
17
27
  expect(HardwareErrorCodeMessage[HardwareErrorCode.BleUnavailableWhileUsbConnected]).toBe(
@@ -33,4 +43,13 @@ describe('HardwareErrorCode compatibility', () => {
33
43
  },
34
44
  });
35
45
  });
46
+
47
+ test('recognizes the macOS CoreBluetooth stale-pairing error without matching generic failures', () => {
48
+ expect(
49
+ isBleStaleBondErrorText(
50
+ 'CBErrorDomain:14 Peer removed pairing information on the device side'
51
+ )
52
+ ).toBe(true);
53
+ expect(isBleStaleBondErrorText('connection failed')).toBe(false);
54
+ });
36
55
  });
@@ -534,7 +534,8 @@ export const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping = {
534
534
  [HardwareErrorCode.DeviceInterruptedFromOutside]: 'Device interrupted',
535
535
  [HardwareErrorCode.DeviceInterruptedFromUser]: 'Device interrupted',
536
536
  [HardwareErrorCode.RequiredButInBootloaderMode]: 'Device should be in bootloader mode',
537
- [HardwareErrorCode.DeviceCheckDeviceIdError]: 'Device Id in the features is not same.',
537
+ [HardwareErrorCode.DeviceCheckDeviceIdError]:
538
+ 'The connected device does not match this wallet. Reconnect the correct device, or add it again after a reset or recovery.',
538
539
  [HardwareErrorCode.DeviceNotSupportPassphrase]: 'Device not support passphrase',
539
540
  [HardwareErrorCode.DeviceCheckPassphraseStateError]: 'Device passphrase state error',
540
541
  [HardwareErrorCode.DeviceNotOpenedPassphrase]: 'Device not opened passphrase',
@@ -542,7 +543,8 @@ export const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping = {
542
543
  [HardwareErrorCode.DeviceDetectInBootloaderMode]: 'Device in bootloader mode',
543
544
  [HardwareErrorCode.NotAllowInBootloaderMode]: 'Device not allow in bootloader mode',
544
545
  [HardwareErrorCode.DeviceBusy]: 'Device is busy',
545
- [HardwareErrorCode.DeviceCheckUnlockTypeError]: 'Device check unlock type not match error',
546
+ [HardwareErrorCode.DeviceCheckUnlockTypeError]:
547
+ 'The unlocked wallet does not match the selected wallet. Use the corresponding PIN or passphrase and try again.',
546
548
  /**
547
549
  * Node Errors
548
550
  */
@@ -660,7 +662,6 @@ export const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping = {
660
662
  [HardwareErrorCode.WalletSessionInvalid]: 'Wallet session is invalid or expired',
661
663
  [HardwareErrorCode.NftStorageLimitReached]:
662
664
  'NFT storage limit reached. Remove an NFT from the device and try again.',
663
-
664
665
  /**
665
666
  * Lowlevel transport
666
667
  */
@@ -682,6 +683,25 @@ export const TypedError = (
682
683
  return new HardwareError({ errorCode: hardwareError, message: message ?? '', params });
683
684
  };
684
685
 
686
+ export const isBleStaleBondHardwareError = (error: unknown): boolean => {
687
+ const code = (error as { errorCode?: unknown })?.errorCode;
688
+ return (
689
+ code === HardwareErrorCode.BleDeviceBondError ||
690
+ code === HardwareErrorCode.BlePeerRemovedPairingInformation
691
+ );
692
+ };
693
+
694
+ export const isBleStaleBondErrorText = (text: string): boolean => {
695
+ const value = text.toLowerCase();
696
+ return (
697
+ value.includes('encryption is insufficient') ||
698
+ value.includes('insufficient encryption') ||
699
+ value.includes('peer removed pairing information') ||
700
+ value.includes('cberrordomain:14') ||
701
+ value.includes('gatt_insuf_authentication')
702
+ );
703
+ };
704
+
685
705
  export const serializeError = (payload: any) => {
686
706
  if (payload && payload.error instanceof HardwareError) {
687
707
  return {
package/src/constants.ts CHANGED
@@ -344,6 +344,30 @@ export const hasOnekeyCommunicationService = (
344
344
  matchesKnownBleUuid(uuid, ONEKEY_COMMUNICATION_SERVICE_ALIASES)
345
345
  );
346
346
 
347
+ /**
348
+ * Protocol V2 family (Pro2 / Neo) by advertised BLE name. Callers use it to
349
+ * pick a connection strategy: this family also advertises under Find My names
350
+ * that carry no OneKey service UUID, so a scan cannot always see it.
351
+ */
352
+ export const isPro2FamilyBleName = (value?: string | null): boolean => {
353
+ if (!value) {
354
+ return false;
355
+ }
356
+ const normalized = value.trim().toLowerCase();
357
+ if (!normalized) {
358
+ return false;
359
+ }
360
+ if (normalized.startsWith('pro2') || normalized.startsWith('neo')) {
361
+ return true;
362
+ }
363
+ const compact = compactBleName(normalized);
364
+ return (
365
+ PRO2_COMPACT_NAME_PATTERN.test(compact) ||
366
+ NEO_COMPACT_NAME_PATTERN.test(compact) ||
367
+ isPro2FindMyAdvertisementName(value)
368
+ );
369
+ };
370
+
347
371
  export const isOnekeyBluetoothDevice = ({
348
372
  id,
349
373
  name,