@ukeyfe/hardware-core 1.1.30 → 1.1.31

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.
Files changed (91) hide show
  1. package/__tests__/evmSignTransaction.test.ts +4 -1
  2. package/dist/api/FirmwareUpdateV2.d.ts.map +1 -1
  3. package/dist/api/aptos/AptosSignInMessage.d.ts +4 -1
  4. package/dist/api/aptos/AptosSignInMessage.d.ts.map +1 -1
  5. package/dist/api/aptos/AptosSignTransaction.d.ts +4 -1
  6. package/dist/api/aptos/AptosSignTransaction.d.ts.map +1 -1
  7. package/dist/api/benfen/BenfenGetAddress.d.ts +4 -1
  8. package/dist/api/benfen/BenfenGetAddress.d.ts.map +1 -1
  9. package/dist/api/benfen/BenfenGetPublicKey.d.ts +4 -1
  10. package/dist/api/benfen/BenfenGetPublicKey.d.ts.map +1 -1
  11. package/dist/api/benfen/BenfenSignMessage.d.ts +4 -1
  12. package/dist/api/benfen/BenfenSignMessage.d.ts.map +1 -1
  13. package/dist/api/benfen/BenfenSignTransaction.d.ts +4 -1
  14. package/dist/api/benfen/BenfenSignTransaction.d.ts.map +1 -1
  15. package/dist/api/btc/BTCSignMessage.d.ts +4 -1
  16. package/dist/api/btc/BTCSignMessage.d.ts.map +1 -1
  17. package/dist/api/btc/BTCSignPsbt.d.ts +4 -1
  18. package/dist/api/btc/BTCSignPsbt.d.ts.map +1 -1
  19. package/dist/api/cardano/CardanoSignMessage.d.ts +4 -1
  20. package/dist/api/cardano/CardanoSignMessage.d.ts.map +1 -1
  21. package/dist/api/cardano/CardanoSignTransaction.d.ts.map +1 -1
  22. package/dist/api/evm/EVMSignTransaction.d.ts +6 -2
  23. package/dist/api/evm/EVMSignTransaction.d.ts.map +1 -1
  24. package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
  25. package/dist/api/kaspa/KaspaGetAddress.d.ts +4 -1
  26. package/dist/api/kaspa/KaspaGetAddress.d.ts.map +1 -1
  27. package/dist/api/kaspa/KaspaSignTransaction.d.ts +4 -1
  28. package/dist/api/kaspa/KaspaSignTransaction.d.ts.map +1 -1
  29. package/dist/api/neo/NeoGetAddress.d.ts +4 -1
  30. package/dist/api/neo/NeoGetAddress.d.ts.map +1 -1
  31. package/dist/api/neo/NeoSignTransaction.d.ts +4 -1
  32. package/dist/api/neo/NeoSignTransaction.d.ts.map +1 -1
  33. package/dist/api/solana/SolSignMessage.d.ts +4 -1
  34. package/dist/api/solana/SolSignMessage.d.ts.map +1 -1
  35. package/dist/api/solana/SolSignOffchainMessage.d.ts +4 -1
  36. package/dist/api/solana/SolSignOffchainMessage.d.ts.map +1 -1
  37. package/dist/api/ton/TonSignMessage.d.ts.map +1 -1
  38. package/dist/api/tron/TronSignMessage.d.ts +4 -1
  39. package/dist/api/tron/TronSignMessage.d.ts.map +1 -1
  40. package/dist/api/tron/TronSignTransaction.d.ts.map +1 -1
  41. package/dist/data-manager/DataManager.d.ts.map +1 -1
  42. package/dist/device/Device.d.ts.map +1 -1
  43. package/dist/index.d.ts +1 -1
  44. package/dist/index.js +202 -82
  45. package/dist/types/device.d.ts +1 -1
  46. package/dist/types/device.d.ts.map +1 -1
  47. package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
  48. package/dist/utils/deviceSettings.d.ts.map +1 -1
  49. package/dist/utils/homescreen.d.ts +1 -1
  50. package/dist/utils/homescreen.d.ts.map +1 -1
  51. package/package.json +4 -4
  52. package/src/api/FirmwareUpdateV2.ts +5 -4
  53. package/src/api/FirmwareUpdateV3.ts +2 -2
  54. package/src/api/allnetwork/AllNetworkGetAddressBase.ts +1 -1
  55. package/src/api/aptos/AptosSignInMessage.ts +4 -1
  56. package/src/api/aptos/AptosSignTransaction.ts +4 -1
  57. package/src/api/benfen/BenfenGetAddress.ts +4 -1
  58. package/src/api/benfen/BenfenGetPublicKey.ts +4 -1
  59. package/src/api/benfen/BenfenSignMessage.ts +4 -1
  60. package/src/api/benfen/BenfenSignTransaction.ts +4 -1
  61. package/src/api/btc/BTCSignMessage.ts +4 -1
  62. package/src/api/btc/BTCSignPsbt.ts +4 -1
  63. package/src/api/cardano/CardanoSignMessage.ts +4 -1
  64. package/src/api/cardano/CardanoSignTransaction.ts +4 -1
  65. package/src/api/device/DeviceFullyUploadResource.ts +1 -1
  66. package/src/api/device/DeviceUploadResource.ts +1 -1
  67. package/src/api/evm/EVMSignTransaction.ts +4 -1
  68. package/src/api/evm/EVMSignTypedData.ts +2 -2
  69. package/src/api/evm/latest/signTypedHash.ts +2 -2
  70. package/src/api/evm/legacyV1/signTypedHash.ts +2 -2
  71. package/src/api/firmware/FirmwareUpdateBaseMethod.ts +4 -3
  72. package/src/api/kaspa/KaspaGetAddress.ts +4 -1
  73. package/src/api/kaspa/KaspaSignTransaction.ts +4 -1
  74. package/src/api/neo/NeoGetAddress.ts +4 -1
  75. package/src/api/neo/NeoSignTransaction.ts +4 -1
  76. package/src/api/solana/SolSignMessage.ts +4 -1
  77. package/src/api/solana/SolSignOffchainMessage.ts +4 -1
  78. package/src/api/ton/TonSignMessage.ts +12 -3
  79. package/src/api/tron/TronSignMessage.ts +4 -1
  80. package/src/api/tron/TronSignTransaction.ts +8 -2
  81. package/src/core/index.ts +1 -1
  82. package/src/data-manager/DataManager.ts +12 -7
  83. package/src/data-manager/MessagesConfig.ts +1 -1
  84. package/src/device/Device.ts +6 -2
  85. package/src/types/device.ts +6 -4
  86. package/src/types/settings.ts +1 -1
  87. package/src/utils/deviceFeaturesUtils.ts +12 -12
  88. package/src/utils/deviceInfoUtils.ts +15 -5
  89. package/src/utils/deviceSettings.ts +6 -3
  90. package/src/utils/deviceVersionUtils.ts +1 -1
  91. package/src/utils/homescreen.ts +30 -8
@@ -96,12 +96,13 @@ export type IDeviceType =
96
96
  | EDeviceType.ClassicPure
97
97
  | EDeviceType.Mini
98
98
  | EDeviceType.Touch
99
- | EDeviceType.Pro;
99
+ | EDeviceType.Core26
100
+ | EDeviceType.Core27Pro;
100
101
 
101
102
  /**
102
103
  * model_classic: 'classic' | 'classic1s' | 'classicpure'
103
104
  * model_mini: 'classic' | 'classic1s' | 'classicpure' | 'mini'
104
- * model_touch: 'touch' | 'pro'
105
+ * model_touch: 'touch' | 'core26' | 'core27pro'
105
106
  */
106
107
  export type IDeviceModel = 'model_classic' | 'model_mini' | 'model_touch' | 'model_classic1s';
107
108
 
@@ -112,7 +113,7 @@ export const DeviceModelToTypes: { [deviceModel in IDeviceModel]: IDeviceType[]
112
113
  EDeviceType.ClassicPure,
113
114
  EDeviceType.Mini,
114
115
  ],
115
- model_touch: [EDeviceType.Touch, EDeviceType.Pro],
116
+ model_touch: [EDeviceType.Touch, EDeviceType.Core26, EDeviceType.Core27Pro],
116
117
  model_classic: [EDeviceType.Classic, EDeviceType.Classic1s, EDeviceType.ClassicPure],
117
118
  model_classic1s: [EDeviceType.Classic1s, EDeviceType.ClassicPure],
118
119
  };
@@ -123,7 +124,8 @@ export const DeviceTypeToModels: { [deviceType in IDeviceType]: IDeviceModel[] }
123
124
  [EDeviceType.ClassicPure]: ['model_classic', 'model_mini', 'model_classic1s'],
124
125
  [EDeviceType.Mini]: ['model_mini'],
125
126
  [EDeviceType.Touch]: ['model_touch'],
126
- [EDeviceType.Pro]: ['model_touch'],
127
+ [EDeviceType.Core26]: ['model_touch'],
128
+ [EDeviceType.Core27Pro]: ['model_touch'],
127
129
  [EDeviceType.Unknown]: [],
128
130
  };
129
131
 
@@ -109,7 +109,7 @@ export type DeviceTypeMap = {
109
109
  [k in IKnownDevice]: {
110
110
  /** Base firmware field (required for backward compatibility) */
111
111
  firmware: IFirmwareReleaseInfo[];
112
- /** Firmware v2 (Touch/Pro specific) */
112
+ /** Firmware v2 (Touch/Core26/Core27Pro specific) */
113
113
  'firmware-v2'?: IFirmwareReleaseInfo[];
114
114
  /** Universal firmware v7 */
115
115
  'firmware-v8'?: IFirmwareReleaseInfo[];
@@ -56,7 +56,7 @@ export const supportInputPinOnSoftware = (features: Features): SupportFeatureTyp
56
56
  if (!features) return { support: false };
57
57
 
58
58
  const deviceType = getDeviceType(features);
59
- if (deviceType === EDeviceType.Touch || deviceType === EDeviceType.Pro) {
59
+ if (deviceType === EDeviceType.Touch || deviceType === EDeviceType.Core26 || deviceType === EDeviceType.Core27Pro) {
60
60
  return { support: false };
61
61
  }
62
62
 
@@ -68,7 +68,7 @@ export const supportNewPassphrase = (features?: Features): SupportFeatureType =>
68
68
  if (!features) return { support: false };
69
69
 
70
70
  const deviceType = getDeviceType(features);
71
- if (deviceType === EDeviceType.Touch || deviceType === EDeviceType.Pro) {
71
+ if (deviceType === EDeviceType.Touch || deviceType === EDeviceType.Core26 || deviceType === EDeviceType.Core27Pro) {
72
72
  return { support: true };
73
73
  }
74
74
 
@@ -96,13 +96,13 @@ export const getPassphraseStateWithRefreshDeviceInfo = async (
96
96
  );
97
97
 
98
98
  const isModeT =
99
- getDeviceType(features) === EDeviceType.Touch || getDeviceType(features) === EDeviceType.Pro;
99
+ getDeviceType(features) === EDeviceType.Touch || getDeviceType(features) === EDeviceType.Core26 || getDeviceType(features) === EDeviceType.Core27Pro;
100
100
 
101
101
  // 如果可以获取到 passphraseState,但是设备 features 显示设备未开启 passphrase,需要刷新设备状态
102
102
  // if passphraseState can be obtained, but the device features show that the device has not enabled passphrase, the device status needs to be refreshed
103
103
  const needRefreshWithPassphrase = passphraseState && features?.passphrase_protection !== true;
104
- // 如果 Touch/Pro 在之前是锁定状态,刷新设备状态
105
- // if Touch/Pro was locked before, refresh the device state
104
+ // 如果 Touch/Core26/Core27Pro 在之前是锁定状态,刷新设备状态
105
+ // if Touch/Core26/Core27Pro was locked before, refresh the device state
106
106
  const needRefreshWithLocked = isModeT && locked;
107
107
 
108
108
  if (needRefreshWithLocked || needRefreshWithPassphrase) {
@@ -148,7 +148,7 @@ export const getPassphraseState = async (
148
148
  );
149
149
  const supportGetPassphraseState =
150
150
  supportAttachPinCapability ||
151
- (deviceType === EDeviceType.Pro && semver.gte(firmwareVersion.join('.'), '4.15.0'));
151
+ ((deviceType === EDeviceType.Core26 || deviceType === EDeviceType.Core27Pro) && semver.gte(firmwareVersion.join('.'), '4.15.0'));
152
152
 
153
153
  if (supportGetPassphraseState) {
154
154
  const { message, type } = await commands.typedCall('GetPassphraseState', 'PassphraseState', {
@@ -197,7 +197,7 @@ export const supportBatchPublicKey = (
197
197
 
198
198
  const deviceType = getDeviceType(features);
199
199
  // btc batch get public key
200
- if (!!options?.includeNode && deviceType === EDeviceType.Pro) {
200
+ if (!!options?.includeNode && (deviceType === EDeviceType.Core26 || deviceType === EDeviceType.Core27Pro)) {
201
201
  return semver.gte(currentVersion, '4.14.0');
202
202
  }
203
203
  if (!!options?.includeNode && deviceType === EDeviceType.Touch) {
@@ -214,7 +214,7 @@ export const supportBatchPublicKey = (
214
214
  }
215
215
 
216
216
  // support batch get public key
217
- if (deviceType === EDeviceType.Touch || deviceType === EDeviceType.Pro) {
217
+ if (deviceType === EDeviceType.Touch || deviceType === EDeviceType.Core26 || deviceType === EDeviceType.Core27Pro) {
218
218
  return semver.gte(currentVersion, '3.1.0');
219
219
  }
220
220
 
@@ -275,7 +275,7 @@ export const getFirmwareUpdateField = ({
275
275
 
276
276
  return latestFirmwareField;
277
277
  }
278
- if (deviceType === EDeviceType.Pro) {
278
+ if (deviceType === EDeviceType.Core26 || deviceType === EDeviceType.Core27Pro) {
279
279
  return latestFirmwareField;
280
280
  }
281
281
  return 'firmware';
@@ -317,7 +317,7 @@ export const getFirmwareUpdateFieldArray = (
317
317
  return ['firmware'];
318
318
  }
319
319
 
320
- if (deviceType === 'pro') {
320
+ if (deviceType === 'core26' || deviceType === 'core27pro') {
321
321
  return ['firmware-v8'];
322
322
  }
323
323
 
@@ -336,8 +336,8 @@ export function fixVersion(version: string) {
336
336
  }
337
337
 
338
338
  export const fixFeaturesFirmwareVersion = (features: Features): Features => {
339
- // 修复 Touch、Pro 设备 bootloader 低于 2.5.2 版本时,返回的 features 中没有 firmware_version 错误的问题
340
- // fix Touch、Pro device when bootloader version is lower than 2.5.2, the features returned do not have firmware_version error
339
+ // 修复 Touch、Core26、Core27Pro 设备 bootloader 低于 2.5.2 版本时,返回的 features 中没有 firmware_version 错误的问题
340
+ // fix Touch、Core26、Core27Pro device when bootloader version is lower than 2.5.2, the features returned do not have firmware_version error
341
341
  const tempFeatures = { ...features };
342
342
 
343
343
  if (tempFeatures.ukey_firmware_version && !semver.valid(tempFeatures.ukey_firmware_version)) {
@@ -15,7 +15,7 @@ export const getDeviceType = (features?: Features): IDeviceType => {
15
15
  return EDeviceType.Unknown;
16
16
  }
17
17
 
18
- // classic1s 3.5.0 pro 4.6.0
18
+ // classic1s 3.5.0, core26 4.6.0
19
19
  switch (features.ukey_device_type) {
20
20
  case 'CLASSIC':
21
21
  return EDeviceType.Classic;
@@ -25,8 +25,10 @@ export const getDeviceType = (features?: Features): IDeviceType => {
25
25
  return EDeviceType.Mini;
26
26
  case 'TOUCH':
27
27
  return EDeviceType.Touch;
28
- case 'PRO':
29
- return EDeviceType.Pro;
28
+ case 'CORE26':
29
+ return EDeviceType.Core26;
30
+ case 'CORE27PRO':
31
+ return EDeviceType.Core27Pro;
30
32
  case 'PURE':
31
33
  return EDeviceType.ClassicPure;
32
34
  default:
@@ -55,7 +57,8 @@ export const getDeviceType = (features?: Features): IDeviceType => {
55
57
  if (miniFlag.toLowerCase() === 'cp') return EDeviceType.ClassicPure;
56
58
  if (miniFlag.toLowerCase() === 'mi') return EDeviceType.Mini;
57
59
  if (miniFlag.toLowerCase() === 'tc') return EDeviceType.Touch;
58
- if (miniFlag.toLowerCase() === 'pr') return EDeviceType.Pro;
60
+ if (miniFlag.toLowerCase() === 'c6') return EDeviceType.Core26;
61
+ if (miniFlag.toLowerCase() === 'c7') return EDeviceType.Core27Pro;
59
62
 
60
63
  // unknown device
61
64
  return EDeviceType.Unknown;
@@ -74,7 +77,8 @@ export const getDeviceTypeByBleName = (name?: string): IDeviceType => {
74
77
  if (name.startsWith('T')) return EDeviceType.Touch;
75
78
  if (name.startsWith('Touch')) return EDeviceType.Touch;
76
79
 
77
- if (name.startsWith('Pro')) return EDeviceType.Pro;
80
+ if (name.startsWith('Core26')) return EDeviceType.Core26;
81
+ if (name.startsWith('Core27')) return EDeviceType.Core27Pro;
78
82
 
79
83
  return EDeviceType.Unknown;
80
84
  };
@@ -115,6 +119,12 @@ export const getDeviceLabel = (features?: Features) => {
115
119
  if (deviceType === EDeviceType.ClassicPure) {
116
120
  return 'UKey Classic 1S';
117
121
  }
122
+ if (deviceType === EDeviceType.Core26) {
123
+ return 'UKey Core 26';
124
+ }
125
+ if (deviceType === EDeviceType.Core27Pro) {
126
+ return 'UKey Core 27 Pro';
127
+ }
118
128
 
119
129
  return `UKey ${deviceType.charAt(0).toUpperCase() + deviceType.slice(1)}`;
120
130
  };
@@ -33,7 +33,8 @@ export const getLanguageConfig = (deviceType: IDeviceType): Record<string, strin
33
33
  break;
34
34
 
35
35
  case EDeviceType.Touch:
36
- case EDeviceType.Pro:
36
+ case EDeviceType.Core26:
37
+ case EDeviceType.Core27Pro:
37
38
  keys = Object.keys(LANGUAGE_LABELS) as LanguageKey[];
38
39
  break;
39
40
  default:
@@ -65,7 +66,8 @@ export const getAutoLockOptions = (_deviceType: IDeviceType): DurationParts[] =>
65
66
  { seconds: 0, minute: 0, hour: 0, day: 0 },
66
67
  ];
67
68
  case EDeviceType.Touch:
68
- case EDeviceType.Pro:
69
+ case EDeviceType.Core26:
70
+ case EDeviceType.Core27Pro:
69
71
  return [
70
72
  { seconds: 30, minute: 0, hour: 0, day: 0 },
71
73
  { seconds: 0, minute: 1, hour: 0, day: 0 },
@@ -95,7 +97,8 @@ export const getAutoShutDownOptions = (_deviceType: IDeviceType): DurationParts[
95
97
  { seconds: 0, minute: 0, hour: 0, day: 0 },
96
98
  ];
97
99
  case EDeviceType.Touch:
98
- case EDeviceType.Pro:
100
+ case EDeviceType.Core26:
101
+ case EDeviceType.Core27Pro:
99
102
  return [
100
103
  { seconds: 0, minute: 1, hour: 0, day: 0 },
101
104
  { seconds: 0, minute: 2, hour: 0, day: 0 },
@@ -45,7 +45,7 @@ export const getDeviceBLEFirmwareVersion = (features: Features): IVersionArray =
45
45
  export const getDeviceBootloaderVersion = (features: Features | undefined): IVersionArray => {
46
46
  if (!features) return [0, 0, 0];
47
47
 
48
- // classic1s 3.5.0 pro 4.6.0
48
+ // classic1s 3.5.0, core26 4.6.0
49
49
  if (semver.valid(features.ukey_boot_version)) {
50
50
  return features.ukey_boot_version?.split('.') as unknown as IVersionArray;
51
51
  }
@@ -229,7 +229,7 @@ export const getTouchData = (): Record<string, IScreenData> => ({
229
229
  'wallpaper-3': { name: 'wallpaper-3', hex: '77616c6c70617065722d332e706e67' },
230
230
  'wallpaper-4': { name: 'wallpaper-4', hex: '77616c6c70617065722d342e706e67' },
231
231
  });
232
- export const getProData = (): Record<string, IScreenData> => ({
232
+ export const getCore26Data = (): Record<string, IScreenData> => ({
233
233
  'wallpaper-1': { name: 'wallpaper-1', hex: '77616c6c70617065722d312e6a7067' },
234
234
  'wallpaper-2': { name: 'wallpaper-2', hex: '77616c6c70617065722d322e6a7067' },
235
235
  'wallpaper-3': { name: 'wallpaper-3', hex: '77616c6c70617065722d332e6a7067' },
@@ -251,8 +251,11 @@ export const getHomeScreenHex = (deviceType: IDeviceType, name: string) => {
251
251
  case EDeviceType.Touch:
252
252
  data = getTouchData();
253
253
  break;
254
- case EDeviceType.Pro:
255
- data = getProData();
254
+ case EDeviceType.Core26:
255
+ data = getCore26Data();
256
+ break;
257
+ case EDeviceType.Core27Pro:
258
+ data = getCore26Data();
256
259
  break;
257
260
  default:
258
261
  data = {};
@@ -276,14 +279,26 @@ export const getHomeScreenDefaultList = (features: Features) => {
276
279
  case EDeviceType.Touch:
277
280
  data = getTouchData();
278
281
  break;
279
- case EDeviceType.Pro:
282
+ case EDeviceType.Core26:
280
283
  if (semver.gte(deviceVersion, '4.10.0')) {
281
- data = getProData();
284
+ data = getCore26Data();
282
285
  } else {
283
- data = Object.keys(getProData())
286
+ data = Object.keys(getCore26Data())
284
287
  .slice(0, 4)
285
288
  .reduce((obj, key) => {
286
- obj[key] = getProData()[key];
289
+ obj[key] = getCore26Data()[key];
290
+ return obj;
291
+ }, {} as Record<string, IScreenData>);
292
+ }
293
+ break;
294
+ case EDeviceType.Core27Pro:
295
+ if (semver.gte(deviceVersion, '4.10.0')) {
296
+ data = getCore26Data();
297
+ } else {
298
+ data = Object.keys(getCore26Data())
299
+ .slice(0, 4)
300
+ .reduce((obj, key) => {
301
+ obj[key] = getCore26Data()[key];
287
302
  return obj;
288
303
  }, {} as Record<string, IScreenData>);
289
304
  }
@@ -329,7 +344,14 @@ export const getHomeScreenSize = ({
329
344
  },
330
345
  full: { width: 480, height: 800 },
331
346
  },
332
- pro: {
347
+ core26: {
348
+ thumbnail: {
349
+ Nft: { width: 204, height: 204, radius: 20 },
350
+ WallPaper: { width: 144, height: 240, radius: 20 },
351
+ },
352
+ full: { width: 480, height: 800 },
353
+ },
354
+ core27pro: {
333
355
  thumbnail: {
334
356
  Nft: { width: 204, height: 204, radius: 20 },
335
357
  WallPaper: { width: 144, height: 240, radius: 20 },