@onekeyfe/hd-shared 1.2.0-alpha.56 → 1.2.0-alpha.62

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.
@@ -115,9 +115,9 @@ export declare const HardwareErrorCode: {
115
115
  readonly DeviceSettingsLanguageNotSupport: 826;
116
116
  readonly TooManyInputs: 827;
117
117
  readonly PinMismatch: 828;
118
+ readonly KaspaPrevTxIdMismatch: 829;
118
119
  readonly DeviceLocked: 830;
119
120
  readonly WalletSessionInvalid: 831;
120
- readonly NftStorageLimitReached: 832;
121
121
  readonly LowlevelTrasnportConnectError: 900;
122
122
  readonly WebDeviceNotFoundOrNeedsPermission: 901;
123
123
  readonly WebDevicePromptAccessError: 902;
@@ -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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AG,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"}
@@ -54,7 +54,6 @@ type BluetoothDeviceIdentity = {
54
54
  export declare const normalizeBleUuid: (uuid?: string | null) => string;
55
55
  export declare const createKnownBleUuidAliases: (uuid: string) => ReadonlySet<string>;
56
56
  export declare const matchesKnownBleUuid: (actualUuid: string | null | undefined, aliases: ReadonlySet<string>) => boolean;
57
- export declare const isPro2FindMyAdvertisementName: (value?: string | null) => boolean;
58
57
  export declare const hasOnekeyCommunicationService: (serviceUuids: Array<string | null | undefined> | null | undefined) => boolean;
59
58
  export declare const isOnekeyBluetoothDevice: ({ id, name, localName, serviceUuids, }: BluetoothDeviceIdentity) => boolean;
60
59
  export {};
@@ -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,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,iBAC1B,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,IAAI,GAAG,SAAS,YAIhE,CAAC;AAEJ,eAAO,MAAM,uBAAuB,2CAKjC,uBAAuB,KAAG,OAe5B,CAAC"}
package/dist/index.d.ts CHANGED
@@ -61,7 +61,6 @@ type BluetoothDeviceIdentity = {
61
61
  declare const normalizeBleUuid: (uuid?: string | null) => string;
62
62
  declare const createKnownBleUuidAliases: (uuid: string) => ReadonlySet<string>;
63
63
  declare const matchesKnownBleUuid: (actualUuid: string | null | undefined, aliases: ReadonlySet<string>) => boolean;
64
- declare const isPro2FindMyAdvertisementName: (value?: string | null) => boolean;
65
64
  declare const hasOnekeyCommunicationService: (serviceUuids: Array<string | null | undefined> | null | undefined) => boolean;
66
65
  declare const isOnekeyBluetoothDevice: ({ id, name, localName, serviceUuids, }: BluetoothDeviceIdentity) => boolean;
67
66
 
@@ -426,6 +425,10 @@ declare const HardwareErrorCode: {
426
425
  * The two PIN entries did not match while setting/changing PIN on device
427
426
  */
428
427
  readonly PinMismatch: 828;
428
+ /**
429
+ * Device refused to sign: refTxs don't match the spent input's outpoint
430
+ */
431
+ readonly KaspaPrevTxIdMismatch: 829;
429
432
  /**
430
433
  * Protocol V2 device must be unlocked before the requested operation.
431
434
  * @params: { failureCode?: string; subcode?: number; firmwareMessage?: string }
@@ -436,11 +439,6 @@ declare const HardwareErrorCode: {
436
439
  * @params: { failureCode?: string; subcode?: number; firmwareMessage?: string }
437
440
  */
438
441
  readonly WalletSessionInvalid: 831;
439
- /**
440
- * Pro2 NFT storage has reached its item limit.
441
- * @params: { count: number; limit: number }
442
- */
443
- readonly NftStorageLimitReached: 832;
444
442
  /**
445
443
  * Lowlevel transport connect error
446
444
  */
@@ -526,4 +524,4 @@ declare enum EDeviceType {
526
524
  Pro2 = "pro2"
527
525
  }
528
526
 
529
- export { CreateErrorByMessage, CreateHardwareErrorByBridgeError, Deferred, 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_SERVICE_UUID, ONEKEY_WEBUSB_FILTER, ONEKEY_WRITE_CHARACTERISTIC_UUID, TypedError, createDefectiveFirmwareError, createDeferred, createDeprecatedHardwareError, createDeviceNotSupportMethodError, createKnownBleUuidAliases, createNeedUpgradeFirmwareHardwareError, createNewFirmwareForceUpdateHardwareError, createNewFirmwareUnReleaseHardwareError, hasOnekeyCommunicationService, isHeaderChunk, isKnownTrezorWebUsbDevice, isOnekeyBluetoothDevice, isOnekeyDevice, isPro2FindMyAdvertisementName, matchesKnownBleUuid, normalizeBleUuid, serializeError, wait };
527
+ export { CreateErrorByMessage, CreateHardwareErrorByBridgeError, Deferred, 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_SERVICE_UUID, ONEKEY_WEBUSB_FILTER, ONEKEY_WRITE_CHARACTERISTIC_UUID, TypedError, createDefectiveFirmwareError, createDeferred, createDeprecatedHardwareError, createDeviceNotSupportMethodError, createKnownBleUuidAliases, createNeedUpgradeFirmwareHardwareError, createNewFirmwareForceUpdateHardwareError, createNewFirmwareUnReleaseHardwareError, hasOnekeyCommunicationService, isHeaderChunk, isKnownTrezorWebUsbDevice, isOnekeyBluetoothDevice, isOnekeyDevice, matchesKnownBleUuid, normalizeBleUuid, serializeError, wait };
package/dist/index.js CHANGED
@@ -164,9 +164,9 @@ const HardwareErrorCode = {
164
164
  DeviceSettingsLanguageNotSupport: 826,
165
165
  TooManyInputs: 827,
166
166
  PinMismatch: 828,
167
+ KaspaPrevTxIdMismatch: 829,
167
168
  DeviceLocked: 830,
168
169
  WalletSessionInvalid: 831,
169
- NftStorageLimitReached: 832,
170
170
  LowlevelTrasnportConnectError: 900,
171
171
  WebDeviceNotFoundOrNeedsPermission: 901,
172
172
  WebDevicePromptAccessError: 902,
@@ -272,8 +272,8 @@ const HardwareErrorCodeMessage = {
272
272
  [HardwareErrorCode.TooManyInputs]: 'Too many inputs',
273
273
  [HardwareErrorCode.PinMismatch]: 'PIN mismatch',
274
274
  [HardwareErrorCode.DeviceLocked]: 'Device locked',
275
+ [HardwareErrorCode.KaspaPrevTxIdMismatch]: 'Kaspa previous transaction id mismatch',
275
276
  [HardwareErrorCode.WalletSessionInvalid]: 'Wallet session is invalid or expired',
276
- [HardwareErrorCode.NftStorageLimitReached]: 'NFT storage limit reached. Remove an NFT from the device and try again.',
277
277
  [HardwareErrorCode.LowlevelTrasnportConnectError]: 'Lowlevel transport connect error',
278
278
  [HardwareErrorCode.WebDeviceNotFoundOrNeedsPermission]: 'Web-USB or Web-Bluetooth device not found or needs permission',
279
279
  [HardwareErrorCode.WebDevicePromptAccessError]: 'Web-USB or Web-Bluetooth device prompt access error',
@@ -514,20 +514,16 @@ 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 isPro2FindMyAdvertisementName = (value) => {
518
- var _a;
519
- const normalizedName = (_a = value === null || value === void 0 ? void 0 : value.trim().toLowerCase()) !== null && _a !== void 0 ? _a : '';
520
- return /\bpro\s*2\b/.test(normalizedName) && /\bfinde?\s+my\b/.test(normalizedName);
521
- };
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 : ''); };
522
518
  const hasOnekeyCommunicationService = (serviceUuids) => (serviceUuids !== null && serviceUuids !== void 0 ? serviceUuids : []).some(uuid => matchesKnownBleUuid(uuid, ONEKEY_COMMUNICATION_SERVICE_ALIASES));
523
519
  const isOnekeyBluetoothDevice = ({ id, name, localName, serviceUuids, }) => {
524
520
  const advertisedServiceUuids = serviceUuids !== null && serviceUuids !== void 0 ? serviceUuids : [];
521
+ if (isFindMyAdvertisementName(name) || isFindMyAdvertisementName(localName)) {
522
+ return false;
523
+ }
525
524
  if (hasOnekeyCommunicationService(advertisedServiceUuids)) {
526
525
  return true;
527
526
  }
528
- if (isPro2FindMyAdvertisementName(name) || isPro2FindMyAdvertisementName(localName)) {
529
- return false;
530
- }
531
527
  if (advertisedServiceUuids.some(uuid => matchesKnownBleUuid(uuid, FIDO_SERVICE_ALIASES))) {
532
528
  return false;
533
529
  }
@@ -634,7 +630,6 @@ exports.isHeaderChunk = isHeaderChunk;
634
630
  exports.isKnownTrezorWebUsbDevice = isKnownTrezorWebUsbDevice;
635
631
  exports.isOnekeyBluetoothDevice = isOnekeyBluetoothDevice;
636
632
  exports.isOnekeyDevice = isOnekeyDevice;
637
- exports.isPro2FindMyAdvertisementName = isPro2FindMyAdvertisementName;
638
633
  exports.matchesKnownBleUuid = matchesKnownBleUuid;
639
634
  exports.normalizeBleUuid = normalizeBleUuid;
640
635
  exports.serializeError = serializeError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-shared",
3
- "version": "1.2.0-alpha.56",
3
+ "version": "1.2.0-alpha.62",
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": "2c472748d67072307c21f8d33bc021cf18fe2ad7"
29
+ "gitHead": "f38f4fc8bf05aea42a4da5b2bd633544597ad958"
30
30
  }
@@ -1,8 +1,8 @@
1
1
  import { HardwareErrorCode } from './HardwareError';
2
2
 
3
3
  describe('HardwareErrorCode compatibility', () => {
4
- test('preserves published Protocol V2 values while leaving code 829 unused', () => {
5
- expect(HardwareErrorCode).not.toHaveProperty('KaspaPrevTxIdMismatch');
4
+ test('preserves published values when adding Protocol V2 errors', () => {
5
+ expect(HardwareErrorCode.KaspaPrevTxIdMismatch).toBe(829);
6
6
  expect(HardwareErrorCode.DeviceLocked).toBe(830);
7
7
  expect(HardwareErrorCode.WalletSessionInvalid).toBe(831);
8
8
  });
@@ -484,6 +484,11 @@ export const HardwareErrorCode = {
484
484
  */
485
485
  PinMismatch: 828,
486
486
 
487
+ /**
488
+ * Device refused to sign: refTxs don't match the spent input's outpoint
489
+ */
490
+ KaspaPrevTxIdMismatch: 829,
491
+
487
492
  /**
488
493
  * Protocol V2 device must be unlocked before the requested operation.
489
494
  * @params: { failureCode?: string; subcode?: number; firmwareMessage?: string }
@@ -496,12 +501,6 @@ export const HardwareErrorCode = {
496
501
  */
497
502
  WalletSessionInvalid: 831,
498
503
 
499
- /**
500
- * Pro2 NFT storage has reached its item limit.
501
- * @params: { count: number; limit: number }
502
- */
503
- NftStorageLimitReached: 832,
504
-
505
504
  /**
506
505
  * Lowlevel transport connect error
507
506
  */
@@ -654,9 +653,8 @@ export const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping = {
654
653
  [HardwareErrorCode.TooManyInputs]: 'Too many inputs',
655
654
  [HardwareErrorCode.PinMismatch]: 'PIN mismatch',
656
655
  [HardwareErrorCode.DeviceLocked]: 'Device locked',
656
+ [HardwareErrorCode.KaspaPrevTxIdMismatch]: 'Kaspa previous transaction id mismatch',
657
657
  [HardwareErrorCode.WalletSessionInvalid]: 'Wallet session is invalid or expired',
658
- [HardwareErrorCode.NftStorageLimitReached]:
659
- 'NFT storage limit reached. Remove an NFT from the device and try again.',
660
658
 
661
659
  /**
662
660
  * Lowlevel transport
@@ -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 FFFD-only advertisement as OneKey', () => {
23
+ it('does not identify an unnamed FFFD or Find My 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('identifies Pro2 communication advertisements independently of their display name', () => {
30
+ it('keeps Pro2 communication advertisements and rejects its Find My advertisement', () => {
31
31
  expect(
32
32
  isOnekeyBluetoothDevice({
33
33
  name: 'Pro2 A1B2',
@@ -37,33 +37,13 @@ describe('hardware device identity filters', () => {
37
37
  expect(
38
38
  isOnekeyBluetoothDevice({
39
39
  localName: 'Pro2 A1B2 - Find My',
40
- serviceUuids: ['0001', 'fffd'],
41
- })
42
- ).toBe(true);
43
- expect(
44
- isOnekeyBluetoothDevice({
45
- name: 'Pro2 5E9D - Finde My',
46
- serviceUuids: ['0001', 'fffd'],
47
- })
48
- ).toBe(true);
49
- });
50
-
51
- it('rejects Pro2 Find My entries when the communication service is absent', () => {
52
- expect(
53
- isOnekeyBluetoothDevice({
54
- name: 'Pro2 A1B2 - Find My',
55
- })
56
- ).toBe(false);
57
- expect(
58
- isOnekeyBluetoothDevice({
59
- localName: 'OneKey Pro 2 A1B2 - Find My',
60
- serviceUuids: [],
40
+ serviceUuids: ['fffd'],
61
41
  })
62
42
  ).toBe(false);
63
43
  expect(
64
44
  isOnekeyBluetoothDevice({
65
45
  name: 'Pro2 5E9D - Finde My',
66
- serviceUuids: ['fffd'],
46
+ serviceUuids: ['0001', 'fffd'],
67
47
  })
68
48
  ).toBe(false);
69
49
  });
package/src/constants.ts CHANGED
@@ -191,10 +191,8 @@ 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
- export const isPro2FindMyAdvertisementName = (value?: string | null) => {
195
- const normalizedName = value?.trim().toLowerCase() ?? '';
196
- return /\bpro\s*2\b/.test(normalizedName) && /\bfinde?\s+my\b/.test(normalizedName);
197
- };
194
+ const isFindMyAdvertisementName = (value?: string | null) =>
195
+ /\bfinde?\s+my\b/.test(value?.trim().toLowerCase() ?? '');
198
196
 
199
197
  export const hasOnekeyCommunicationService = (
200
198
  serviceUuids: Array<string | null | undefined> | null | undefined
@@ -210,14 +208,12 @@ export const isOnekeyBluetoothDevice = ({
210
208
  serviceUuids,
211
209
  }: BluetoothDeviceIdentity): boolean => {
212
210
  const advertisedServiceUuids = serviceUuids ?? [];
213
- if (hasOnekeyCommunicationService(advertisedServiceUuids)) {
214
- return true;
211
+ if (isFindMyAdvertisementName(name) || isFindMyAdvertisementName(localName)) {
212
+ return false;
215
213
  }
216
214
 
217
- // Android can return a connected Find My peripheral without its advertised
218
- // services. Do not let the Pro2-looking name fall through to name discovery.
219
- if (isPro2FindMyAdvertisementName(name) || isPro2FindMyAdvertisementName(localName)) {
220
- return false;
215
+ if (hasOnekeyCommunicationService(advertisedServiceUuids)) {
216
+ return true;
221
217
  }
222
218
 
223
219
  if (advertisedServiceUuids.some(uuid => matchesKnownBleUuid(uuid, FIDO_SERVICE_ALIASES))) {