@onekeyfe/hd-shared 1.2.0-alpha.36 → 1.2.0-alpha.39

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.
@@ -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,MAAM,OAAO,yBAAyB,CAAC,CAAC;AAE7E,eAAO,MAAM,oBAAoB;;;GAOhC,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC,CAAC;AAIF,eAAO,MAAM,yBAAyB,eAAgB,wBAAwB,KAAG,OAQhF,CAAC;AAMF,eAAO,MAAM,2BAA2B,mDAS9B,CAAC;AAMX,eAAO,MAAM,8BAA8B,qBAGjC,CAAC;AAGX,oBAAY,qBAAqB;IAE/B,UAAU,uBAAuB;IACjC,iBAAiB,8BAA8B;IAC/C,aAAa,0BAA0B;IACvC,kBAAkB,+BAA+B;IACjD,cAAc,2BAA2B;IACzC,oBAAoB,iCAAiC;IAGrD,mBAAmB,gCAAgC;IACnD,oBAAoB,iCAAiC;IAGrD,aAAa,0BAA0B;IACvC,oBAAoB,iCAAiC;IAGrD,uBAAuB,oCAAoC;IAC3D,sBAAsB,mCAAmC;IAGzD,mBAAmB,gCAAgC;IACnD,mBAAmB,gCAAgC;IACnD,oBAAoB,iCAAiC;IACrD,iBAAiB,8BAA8B;IAC/C,oBAAoB,iCAAiC;IACrD,eAAe,4BAA4B;IAC3C,mBAAmB,gCAAgC;IACnD,qBAAqB,kCAAkC;IACvD,sBAAsB,mCAAmC;IACzD,wBAAwB,qCAAqC;CAC9D;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I,CAAC;IAC1B,YAAY,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,IAAI,CAAC;CACxD,CAAC;AAIF,eAAO,MAAM,gBAAgB,UAAW,MAAM,GAAG,IAAI,WACP,CAAC;AAE/C,eAAO,MAAM,yBAAyB,SAAU,MAAM,KAAG,YAAY,MAAM,CAc1E,CAAC;AAEF,eAAO,MAAM,mBAAmB,eAClB,MAAM,GAAG,IAAI,GAAG,SAAS,WAC5B,YAAY,MAAM,CAAC,YACgB,CAAC;AAK/C,eAAO,MAAM,6BAA6B,iBAC1B,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,IAAI,GAAG,SAAS,YAIhE,CAAC;AAEJ,eAAO,MAAM,uBAAuB,2CAKjC,uBAAuB,KAAG,OAW5B,CAAC"}
package/dist/index.js CHANGED
@@ -514,13 +514,9 @@ const createKnownBleUuidAliases = (uuid) => {
514
514
  const matchesKnownBleUuid = (actualUuid, aliases) => aliases.has(normalizeBleUuid(actualUuid));
515
515
  const ONEKEY_COMMUNICATION_SERVICE_ALIASES = createKnownBleUuidAliases(ONEKEY_SERVICE_UUID);
516
516
  const FIDO_SERVICE_ALIASES = createKnownBleUuidAliases('0000fffd-0000-1000-8000-00805f9b34fb');
517
- const isFindMyAdvertisementName = (value) => { var _a; return /\bfinde?\s+my\b/.test((_a = value === null || value === void 0 ? void 0 : value.trim().toLowerCase()) !== null && _a !== void 0 ? _a : ''); };
518
517
  const hasOnekeyCommunicationService = (serviceUuids) => (serviceUuids !== null && serviceUuids !== void 0 ? serviceUuids : []).some(uuid => matchesKnownBleUuid(uuid, ONEKEY_COMMUNICATION_SERVICE_ALIASES));
519
518
  const isOnekeyBluetoothDevice = ({ id, name, localName, serviceUuids, }) => {
520
519
  const advertisedServiceUuids = serviceUuids !== null && serviceUuids !== void 0 ? serviceUuids : [];
521
- if (isFindMyAdvertisementName(name) || isFindMyAdvertisementName(localName)) {
522
- return false;
523
- }
524
520
  if (hasOnekeyCommunicationService(advertisedServiceUuids)) {
525
521
  return true;
526
522
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-shared",
3
- "version": "1.2.0-alpha.36",
3
+ "version": "1.2.0-alpha.39",
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": "94f0fec6ea1dfd4ffea2dae8ea2b0b4a2a6cf2be"
29
+ "gitHead": "2cb8f692689327fc7e77cb848223cbeaa740dcad"
30
30
  }
@@ -20,14 +20,14 @@ describe('hardware device identity filters', () => {
20
20
  expect(isOnekeyDevice('Ledger Nano X')).toBe(false);
21
21
  });
22
22
 
23
- it('does not identify an unnamed FFFD or Find My advertisement as OneKey', () => {
23
+ it('does not identify an FFFD-only advertisement as OneKey', () => {
24
24
  expect(isOnekeyBluetoothDevice({ name: 'Find My', serviceUuids: ['fffd'] })).toBe(false);
25
25
  expect(
26
26
  isOnekeyBluetoothDevice({ serviceUuids: ['0000fffd-0000-1000-8000-00805f9b34fb'] })
27
27
  ).toBe(false);
28
28
  });
29
29
 
30
- it('keeps Pro2 communication advertisements and rejects its Find My advertisement', () => {
30
+ it('identifies Pro2 communication advertisements independently of their display name', () => {
31
31
  expect(
32
32
  isOnekeyBluetoothDevice({
33
33
  name: 'Pro2 A1B2',
@@ -37,15 +37,15 @@ describe('hardware device identity filters', () => {
37
37
  expect(
38
38
  isOnekeyBluetoothDevice({
39
39
  localName: 'Pro2 A1B2 - Find My',
40
- serviceUuids: ['fffd'],
40
+ serviceUuids: ['0001', 'fffd'],
41
41
  })
42
- ).toBe(false);
42
+ ).toBe(true);
43
43
  expect(
44
44
  isOnekeyBluetoothDevice({
45
45
  name: 'Pro2 5E9D - Finde My',
46
46
  serviceUuids: ['0001', 'fffd'],
47
47
  })
48
- ).toBe(false);
48
+ ).toBe(true);
49
49
  });
50
50
 
51
51
  it('keeps OneKey discovery on the communication service', () => {
package/src/constants.ts CHANGED
@@ -191,9 +191,6 @@ export const matchesKnownBleUuid = (
191
191
  const ONEKEY_COMMUNICATION_SERVICE_ALIASES = createKnownBleUuidAliases(ONEKEY_SERVICE_UUID);
192
192
  const FIDO_SERVICE_ALIASES = createKnownBleUuidAliases('0000fffd-0000-1000-8000-00805f9b34fb');
193
193
 
194
- const isFindMyAdvertisementName = (value?: string | null) =>
195
- /\bfinde?\s+my\b/.test(value?.trim().toLowerCase() ?? '');
196
-
197
194
  export const hasOnekeyCommunicationService = (
198
195
  serviceUuids: Array<string | null | undefined> | null | undefined
199
196
  ) =>
@@ -208,10 +205,6 @@ export const isOnekeyBluetoothDevice = ({
208
205
  serviceUuids,
209
206
  }: BluetoothDeviceIdentity): boolean => {
210
207
  const advertisedServiceUuids = serviceUuids ?? [];
211
- if (isFindMyAdvertisementName(name) || isFindMyAdvertisementName(localName)) {
212
- return false;
213
- }
214
-
215
208
  if (hasOnekeyCommunicationService(advertisedServiceUuids)) {
216
209
  return true;
217
210
  }