@onekeyfe/hd-core 1.1.27-alpha.30 → 1.1.27-alpha.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.
- package/__tests__/evmSignTransaction.test.ts +1 -1
- package/__tests__/evmSignTypedData.test.ts +1 -1
- package/__tests__/protocol-v2.test.ts +189 -33
- package/dist/api/GetPassphraseState.d.ts +6 -1
- package/dist/api/GetPassphraseState.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignTransaction.d.ts.map +1 -1
- package/dist/api/dynex/DnxGetAddress.d.ts.map +1 -1
- package/dist/api/dynex/DnxSignTransaction.d.ts.map +1 -1
- package/dist/api/helpers/batchGetPublickeys.d.ts.map +1 -1
- package/dist/api/index.d.ts +5 -5
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts +7 -0
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts +7 -0
- package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts +6 -0
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts +6 -0
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceReboot.d.ts +7 -0
- package/dist/api/protocol-v2/DeviceReboot.d.ts.map +1 -0
- package/dist/api/protocol-v2/helpers.d.ts +19 -19
- package/dist/api/protocol-v2/helpers.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +4 -3
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/data-manager/MessagesConfig.d.ts +2 -2
- package/dist/data-manager/MessagesConfig.d.ts.map +1 -1
- package/dist/data-manager/TransportManager.d.ts +3 -3
- package/dist/data-manager/TransportManager.d.ts.map +1 -1
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/index.d.ts +34 -27
- package/dist/index.js +231 -184
- package/dist/protocols/protocol-v2/features.d.ts +1 -0
- package/dist/protocols/protocol-v2/features.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/firmware.d.ts +7 -7
- package/dist/types/api/getPassphraseState.d.ts +7 -1
- package/dist/types/api/getPassphraseState.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +7 -6
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/protocolV2.d.ts +16 -16
- package/dist/types/api/protocolV2.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesUtils.d.ts +3 -3
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/dist/utils/patch.d.ts +1 -1
- package/dist/utils/patch.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/FirmwareUpdateV4.ts +13 -13
- package/src/api/GetPassphraseState.ts +14 -2
- package/src/api/allnetwork/AllNetworkGetAddressBase.ts +15 -0
- package/src/api/conflux/ConfluxSignTransaction.ts +5 -2
- package/src/api/device/DeviceRebootToBoardloader.ts +4 -4
- package/src/api/device/DeviceRebootToBootloader.ts +4 -4
- package/src/api/dynex/DnxGetAddress.ts +7 -0
- package/src/api/dynex/DnxSignTransaction.ts +7 -0
- package/src/api/evm/EVMGetAddress.ts +1 -1
- package/src/api/evm/EVMGetPublicKey.ts +1 -1
- package/src/api/evm/EVMSignMessage.ts +1 -1
- package/src/api/evm/EVMSignTransaction.ts +1 -1
- package/src/api/evm/EVMSignTypedData.ts +6 -6
- package/src/api/evm/EVMVerifyMessage.ts +1 -1
- package/src/api/helpers/batchGetPublickeys.ts +4 -2
- package/src/api/index.ts +5 -5
- package/src/api/protocol-v2/{DevFirmwareUpdate.ts → DeviceFirmwareUpdate.ts} +3 -3
- package/src/api/protocol-v2/{DevGetDeviceInfo.ts → DeviceGetDeviceInfo.ts} +3 -3
- package/src/api/protocol-v2/{DevGetFirmwareUpdateStatus.ts → DeviceGetFirmwareUpdateStatus.ts} +3 -3
- package/src/api/protocol-v2/{DevGetOnboardingStatus.ts → DeviceGetOnboardingStatus.ts} +3 -3
- package/src/api/protocol-v2/{DevReboot.ts → DeviceReboot.ts} +3 -3
- package/src/api/protocol-v2/helpers.ts +38 -38
- package/src/api/tron/TronSignMessage.ts +1 -1
- package/src/api/xrp/XrpSignTransaction.ts +1 -1
- package/src/core/index.ts +5 -1
- package/src/data/messages/messages-pro2.json +67 -63
- package/src/data-manager/DataManager.ts +7 -6
- package/src/data-manager/MessagesConfig.ts +14 -14
- package/src/data-manager/TransportManager.ts +12 -12
- package/src/device/Device.ts +7 -3
- package/src/inject.ts +9 -9
- package/src/protocols/protocol-v2/features.ts +7 -6
- package/src/protocols/protocol-v2/firmware.ts +16 -16
- package/src/types/api/getPassphraseState.ts +10 -1
- package/src/types/api/index.ts +11 -10
- package/src/types/api/protocolV2.ts +27 -27
- package/src/utils/deviceFeaturesUtils.ts +33 -15
- package/dist/api/protocol-v2/DevFirmwareUpdate.d.ts +0 -7
- package/dist/api/protocol-v2/DevFirmwareUpdate.d.ts.map +0 -1
- package/dist/api/protocol-v2/DevGetDeviceInfo.d.ts +0 -7
- package/dist/api/protocol-v2/DevGetDeviceInfo.d.ts.map +0 -1
- package/dist/api/protocol-v2/DevGetFirmwareUpdateStatus.d.ts +0 -6
- package/dist/api/protocol-v2/DevGetFirmwareUpdateStatus.d.ts.map +0 -1
- package/dist/api/protocol-v2/DevGetOnboardingStatus.d.ts +0 -6
- package/dist/api/protocol-v2/DevGetOnboardingStatus.d.ts.map +0 -1
- package/dist/api/protocol-v2/DevReboot.d.ts +0 -7
- package/dist/api/protocol-v2/DevReboot.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -138,11 +138,11 @@ const createCoreApi = (call) => ({
|
|
|
138
138
|
deviceRebootToBootloader: connectId => call({ connectId, method: 'deviceRebootToBootloader' }),
|
|
139
139
|
getProtoVersion: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'getProtoVersion' })),
|
|
140
140
|
ping: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'ping' })),
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
141
|
+
deviceReboot: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceReboot' })),
|
|
142
|
+
deviceGetDeviceInfo: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceGetDeviceInfo' })),
|
|
143
|
+
deviceGetOnboardingStatus: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceGetOnboardingStatus' })),
|
|
144
|
+
deviceFirmwareUpdate: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceFirmwareUpdate' })),
|
|
145
|
+
deviceGetFirmwareUpdateStatus: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceGetFirmwareUpdateStatus' })),
|
|
146
146
|
factoryDeviceInfoSettings: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'factoryDeviceInfoSettings' })),
|
|
147
147
|
factoryGetDeviceInfo: connectId => call({ connectId, method: 'factoryGetDeviceInfo' }),
|
|
148
148
|
filesystemFixPermission: connectId => call({ connectId, method: 'filesystemFixPermission' }),
|
|
@@ -25801,11 +25801,11 @@ var nested = {
|
|
|
25801
25801
|
MessageType_Ping: 60206,
|
|
25802
25802
|
MessageType_Success: 60207,
|
|
25803
25803
|
MessageType_Failure: 60208,
|
|
25804
|
-
|
|
25805
|
-
|
|
25804
|
+
MessageType_DeviceReboot: 60400,
|
|
25805
|
+
MessageType_DeviceGetDeviceInfo: 60600,
|
|
25806
25806
|
MessageType_DeviceInfo: 60601,
|
|
25807
|
-
|
|
25808
|
-
|
|
25807
|
+
MessageType_DeviceGetOnboardingStatus: 60602,
|
|
25808
|
+
MessageType_DeviceOnboardingStatus: 60603,
|
|
25809
25809
|
MessageType_FilesystemFixPermission: 60800,
|
|
25810
25810
|
MessageType_FilesystemPathInfo: 60801,
|
|
25811
25811
|
MessageType_FilesystemPathInfoQuery: 60802,
|
|
@@ -25818,10 +25818,10 @@ var nested = {
|
|
|
25818
25818
|
MessageType_FilesystemDirMake: 60809,
|
|
25819
25819
|
MessageType_FilesystemDirRemove: 60810,
|
|
25820
25820
|
MessageType_FilesystemFormat: 60811,
|
|
25821
|
-
|
|
25822
|
-
|
|
25823
|
-
|
|
25824
|
-
|
|
25821
|
+
MessageType_DeviceFirmwareUpdate: 61000,
|
|
25822
|
+
MessageType_DeviceFirmwareInstallProgress: 61001,
|
|
25823
|
+
MessageType_DeviceGetFirmwareUpdateStatus: 61002,
|
|
25824
|
+
MessageType_DeviceFirmwareUpdateStatus: 61003
|
|
25825
25825
|
}
|
|
25826
25826
|
},
|
|
25827
25827
|
AlephiumGetAddress: {
|
|
@@ -37142,18 +37142,18 @@ var nested = {
|
|
|
37142
37142
|
}
|
|
37143
37143
|
}
|
|
37144
37144
|
},
|
|
37145
|
-
|
|
37145
|
+
DeviceRebootType: {
|
|
37146
37146
|
values: {
|
|
37147
37147
|
Normal: 0,
|
|
37148
37148
|
Boardloader: 1,
|
|
37149
37149
|
Bootloader: 2
|
|
37150
37150
|
}
|
|
37151
37151
|
},
|
|
37152
|
-
|
|
37152
|
+
DeviceReboot: {
|
|
37153
37153
|
fields: {
|
|
37154
37154
|
reboot_type: {
|
|
37155
37155
|
rule: "required",
|
|
37156
|
-
type: "
|
|
37156
|
+
type: "DeviceRebootType",
|
|
37157
37157
|
id: 1
|
|
37158
37158
|
}
|
|
37159
37159
|
}
|
|
@@ -37168,20 +37168,20 @@ var nested = {
|
|
|
37168
37168
|
CLASSIC1S_PURE: 6
|
|
37169
37169
|
}
|
|
37170
37170
|
},
|
|
37171
|
-
|
|
37171
|
+
DeviceSeType: {
|
|
37172
37172
|
values: {
|
|
37173
37173
|
THD89: 0,
|
|
37174
37174
|
SE608A: 1
|
|
37175
37175
|
}
|
|
37176
37176
|
},
|
|
37177
|
-
|
|
37177
|
+
DeviceSEState: {
|
|
37178
37178
|
values: {
|
|
37179
37179
|
BOOT: 0,
|
|
37180
37180
|
APP_FACTORY: 51,
|
|
37181
37181
|
APP: 85
|
|
37182
37182
|
}
|
|
37183
37183
|
},
|
|
37184
|
-
|
|
37184
|
+
DeviceFirmwareImageInfo: {
|
|
37185
37185
|
fields: {
|
|
37186
37186
|
version: {
|
|
37187
37187
|
type: "string",
|
|
@@ -37197,9 +37197,9 @@ var nested = {
|
|
|
37197
37197
|
}
|
|
37198
37198
|
}
|
|
37199
37199
|
},
|
|
37200
|
-
|
|
37200
|
+
DeviceHardwareInfo: {
|
|
37201
37201
|
fields: {
|
|
37202
|
-
|
|
37202
|
+
Device_type: {
|
|
37203
37203
|
type: "DeviceType",
|
|
37204
37204
|
id: 10
|
|
37205
37205
|
},
|
|
@@ -37217,30 +37217,30 @@ var nested = {
|
|
|
37217
37217
|
}
|
|
37218
37218
|
}
|
|
37219
37219
|
},
|
|
37220
|
-
|
|
37220
|
+
DeviceMainMcuInfo: {
|
|
37221
37221
|
fields: {
|
|
37222
37222
|
board: {
|
|
37223
|
-
type: "
|
|
37223
|
+
type: "DeviceFirmwareImageInfo",
|
|
37224
37224
|
id: 10
|
|
37225
37225
|
},
|
|
37226
37226
|
boot: {
|
|
37227
|
-
type: "
|
|
37227
|
+
type: "DeviceFirmwareImageInfo",
|
|
37228
37228
|
id: 20
|
|
37229
37229
|
},
|
|
37230
37230
|
app: {
|
|
37231
|
-
type: "
|
|
37231
|
+
type: "DeviceFirmwareImageInfo",
|
|
37232
37232
|
id: 30
|
|
37233
37233
|
}
|
|
37234
37234
|
}
|
|
37235
37235
|
},
|
|
37236
|
-
|
|
37236
|
+
DeviceBluetoothInfo: {
|
|
37237
37237
|
fields: {
|
|
37238
37238
|
boot: {
|
|
37239
|
-
type: "
|
|
37239
|
+
type: "DeviceFirmwareImageInfo",
|
|
37240
37240
|
id: 20
|
|
37241
37241
|
},
|
|
37242
37242
|
app: {
|
|
37243
|
-
type: "
|
|
37243
|
+
type: "DeviceFirmwareImageInfo",
|
|
37244
37244
|
id: 30
|
|
37245
37245
|
},
|
|
37246
37246
|
adv_name: {
|
|
@@ -37253,27 +37253,27 @@ var nested = {
|
|
|
37253
37253
|
}
|
|
37254
37254
|
}
|
|
37255
37255
|
},
|
|
37256
|
-
|
|
37256
|
+
DeviceSEInfo: {
|
|
37257
37257
|
fields: {
|
|
37258
37258
|
boot: {
|
|
37259
|
-
type: "
|
|
37259
|
+
type: "DeviceFirmwareImageInfo",
|
|
37260
37260
|
id: 20
|
|
37261
37261
|
},
|
|
37262
37262
|
app: {
|
|
37263
|
-
type: "
|
|
37263
|
+
type: "DeviceFirmwareImageInfo",
|
|
37264
37264
|
id: 30
|
|
37265
37265
|
},
|
|
37266
37266
|
type: {
|
|
37267
|
-
type: "
|
|
37267
|
+
type: "DeviceSeType",
|
|
37268
37268
|
id: 100
|
|
37269
37269
|
},
|
|
37270
37270
|
state: {
|
|
37271
|
-
type: "
|
|
37271
|
+
type: "DeviceSEState",
|
|
37272
37272
|
id: 110
|
|
37273
37273
|
}
|
|
37274
37274
|
}
|
|
37275
37275
|
},
|
|
37276
|
-
|
|
37276
|
+
DeviceInfoTargets: {
|
|
37277
37277
|
fields: {
|
|
37278
37278
|
hw: {
|
|
37279
37279
|
type: "bool",
|
|
@@ -37309,7 +37309,7 @@ var nested = {
|
|
|
37309
37309
|
}
|
|
37310
37310
|
}
|
|
37311
37311
|
},
|
|
37312
|
-
|
|
37312
|
+
DeviceInfoTypes: {
|
|
37313
37313
|
fields: {
|
|
37314
37314
|
version: {
|
|
37315
37315
|
type: "bool",
|
|
@@ -37329,7 +37329,7 @@ var nested = {
|
|
|
37329
37329
|
}
|
|
37330
37330
|
}
|
|
37331
37331
|
},
|
|
37332
|
-
|
|
37332
|
+
DeviceStatus: {
|
|
37333
37333
|
fields: {
|
|
37334
37334
|
language: {
|
|
37335
37335
|
type: "string",
|
|
@@ -37357,14 +37357,14 @@ var nested = {
|
|
|
37357
37357
|
}
|
|
37358
37358
|
}
|
|
37359
37359
|
},
|
|
37360
|
-
|
|
37360
|
+
DeviceGetDeviceInfo: {
|
|
37361
37361
|
fields: {
|
|
37362
37362
|
targets: {
|
|
37363
|
-
type: "
|
|
37363
|
+
type: "DeviceInfoTargets",
|
|
37364
37364
|
id: 1
|
|
37365
37365
|
},
|
|
37366
37366
|
types: {
|
|
37367
|
-
type: "
|
|
37367
|
+
type: "DeviceInfoTypes",
|
|
37368
37368
|
id: 2
|
|
37369
37369
|
}
|
|
37370
37370
|
}
|
|
@@ -37377,56 +37377,56 @@ var nested = {
|
|
|
37377
37377
|
id: 1
|
|
37378
37378
|
},
|
|
37379
37379
|
hw: {
|
|
37380
|
-
type: "
|
|
37380
|
+
type: "DeviceHardwareInfo",
|
|
37381
37381
|
id: 100
|
|
37382
37382
|
},
|
|
37383
37383
|
fw: {
|
|
37384
|
-
type: "
|
|
37384
|
+
type: "DeviceMainMcuInfo",
|
|
37385
37385
|
id: 200
|
|
37386
37386
|
},
|
|
37387
37387
|
bt: {
|
|
37388
|
-
type: "
|
|
37388
|
+
type: "DeviceBluetoothInfo",
|
|
37389
37389
|
id: 300
|
|
37390
37390
|
},
|
|
37391
37391
|
se1: {
|
|
37392
|
-
type: "
|
|
37392
|
+
type: "DeviceSEInfo",
|
|
37393
37393
|
id: 400
|
|
37394
37394
|
},
|
|
37395
37395
|
se2: {
|
|
37396
|
-
type: "
|
|
37396
|
+
type: "DeviceSEInfo",
|
|
37397
37397
|
id: 410
|
|
37398
37398
|
},
|
|
37399
37399
|
se3: {
|
|
37400
|
-
type: "
|
|
37400
|
+
type: "DeviceSEInfo",
|
|
37401
37401
|
id: 420
|
|
37402
37402
|
},
|
|
37403
37403
|
se4: {
|
|
37404
|
-
type: "
|
|
37404
|
+
type: "DeviceSEInfo",
|
|
37405
37405
|
id: 430
|
|
37406
37406
|
},
|
|
37407
37407
|
status: {
|
|
37408
|
-
type: "
|
|
37408
|
+
type: "DeviceStatus",
|
|
37409
37409
|
id: 10000
|
|
37410
37410
|
}
|
|
37411
37411
|
}
|
|
37412
37412
|
},
|
|
37413
|
-
|
|
37413
|
+
DeviceFirmwareTargetType: {
|
|
37414
37414
|
values: {
|
|
37415
|
-
|
|
37416
|
-
|
|
37417
|
-
|
|
37418
|
-
|
|
37419
|
-
|
|
37420
|
-
|
|
37421
|
-
|
|
37415
|
+
TARGET_INVALID: 0,
|
|
37416
|
+
TARGET_ROMLOADER: 1,
|
|
37417
|
+
TARGET_BOOTLOADER: 2,
|
|
37418
|
+
TARGET_FIRMWARE_P1: 3,
|
|
37419
|
+
TARGET_FIRMWARE_P2: 4,
|
|
37420
|
+
TARGET_COPROCESSOR: 5,
|
|
37421
|
+
TARGET_SE: 6,
|
|
37422
37422
|
TARGET_RESOURCE: 10
|
|
37423
37423
|
}
|
|
37424
37424
|
},
|
|
37425
|
-
|
|
37425
|
+
DeviceFirmwareTarget: {
|
|
37426
37426
|
fields: {
|
|
37427
37427
|
target_id: {
|
|
37428
37428
|
rule: "required",
|
|
37429
|
-
type: "
|
|
37429
|
+
type: "DeviceFirmwareTargetType",
|
|
37430
37430
|
id: 1
|
|
37431
37431
|
},
|
|
37432
37432
|
path: {
|
|
@@ -37436,20 +37436,24 @@ var nested = {
|
|
|
37436
37436
|
}
|
|
37437
37437
|
}
|
|
37438
37438
|
},
|
|
37439
|
-
|
|
37439
|
+
DeviceFirmwareUpdate: {
|
|
37440
37440
|
fields: {
|
|
37441
37441
|
targets: {
|
|
37442
37442
|
rule: "repeated",
|
|
37443
|
-
type: "
|
|
37443
|
+
type: "DeviceFirmwareTarget",
|
|
37444
37444
|
id: 1
|
|
37445
|
+
},
|
|
37446
|
+
max_concurrent: {
|
|
37447
|
+
type: "uint32",
|
|
37448
|
+
id: 2
|
|
37445
37449
|
}
|
|
37446
37450
|
}
|
|
37447
37451
|
},
|
|
37448
|
-
|
|
37452
|
+
DeviceFirmwareInstallProgress: {
|
|
37449
37453
|
fields: {
|
|
37450
37454
|
target_id: {
|
|
37451
37455
|
rule: "required",
|
|
37452
|
-
type: "
|
|
37456
|
+
type: "DeviceFirmwareTargetType",
|
|
37453
37457
|
id: 1
|
|
37454
37458
|
},
|
|
37455
37459
|
progress: {
|
|
@@ -37463,11 +37467,11 @@ var nested = {
|
|
|
37463
37467
|
}
|
|
37464
37468
|
}
|
|
37465
37469
|
},
|
|
37466
|
-
|
|
37470
|
+
DeviceFirmwareUpdateStatusEntry: {
|
|
37467
37471
|
fields: {
|
|
37468
37472
|
target_id: {
|
|
37469
37473
|
rule: "required",
|
|
37470
|
-
type: "
|
|
37474
|
+
type: "DeviceFirmwareTargetType",
|
|
37471
37475
|
id: 1
|
|
37472
37476
|
},
|
|
37473
37477
|
status: {
|
|
@@ -37477,15 +37481,15 @@ var nested = {
|
|
|
37477
37481
|
}
|
|
37478
37482
|
}
|
|
37479
37483
|
},
|
|
37480
|
-
|
|
37484
|
+
DeviceGetFirmwareUpdateStatus: {
|
|
37481
37485
|
fields: {
|
|
37482
37486
|
}
|
|
37483
37487
|
},
|
|
37484
|
-
|
|
37488
|
+
DeviceFirmwareUpdateStatus: {
|
|
37485
37489
|
fields: {
|
|
37486
37490
|
targets: {
|
|
37487
37491
|
rule: "repeated",
|
|
37488
|
-
type: "
|
|
37492
|
+
type: "DeviceFirmwareUpdateStatusEntry",
|
|
37489
37493
|
id: 1
|
|
37490
37494
|
}
|
|
37491
37495
|
}
|
|
@@ -37755,11 +37759,11 @@ var nested = {
|
|
|
37755
37759
|
fields: {
|
|
37756
37760
|
}
|
|
37757
37761
|
},
|
|
37758
|
-
|
|
37762
|
+
DeviceGetOnboardingStatus: {
|
|
37759
37763
|
fields: {
|
|
37760
37764
|
}
|
|
37761
37765
|
},
|
|
37762
|
-
|
|
37766
|
+
DeviceOnboardingStatus: {
|
|
37763
37767
|
fields: {
|
|
37764
37768
|
page_index: {
|
|
37765
37769
|
type: "uint32",
|
|
@@ -38666,8 +38670,8 @@ class DataManager {
|
|
|
38666
38670
|
}
|
|
38667
38671
|
});
|
|
38668
38672
|
}
|
|
38669
|
-
static getProtobufMessages(
|
|
38670
|
-
return this.messages[
|
|
38673
|
+
static getProtobufMessages(schema = 'protocolV1Current') {
|
|
38674
|
+
return this.messages[schema];
|
|
38671
38675
|
}
|
|
38672
38676
|
static getSettings(key) {
|
|
38673
38677
|
if (!this.settings)
|
|
@@ -38707,8 +38711,8 @@ DataManager.deviceMap = {
|
|
|
38707
38711
|
};
|
|
38708
38712
|
DataManager.assets = null;
|
|
38709
38713
|
DataManager.messages = {
|
|
38710
|
-
|
|
38711
|
-
|
|
38714
|
+
protocolV1Current: MessagesJSON,
|
|
38715
|
+
protocolV1Legacy: MessagesLegacyV1JSON,
|
|
38712
38716
|
protocolV2: MessagesPro2JSON,
|
|
38713
38717
|
};
|
|
38714
38718
|
DataManager.lastCheckTimestamp = 0;
|
|
@@ -38908,23 +38912,23 @@ DataManager.isBrowserWebUsb = (env) => env === 'webusb';
|
|
|
38908
38912
|
|
|
38909
38913
|
const PROTOBUF_MESSAGE_CONFIG = {
|
|
38910
38914
|
model_mini: [
|
|
38911
|
-
{ minVersion: '3.3.0',
|
|
38912
|
-
{ minVersion: '0.0.1',
|
|
38913
|
-
{ minVersion: '0.0.0',
|
|
38915
|
+
{ minVersion: '3.3.0', protocolV1MessageSchema: 'protocolV1Current' },
|
|
38916
|
+
{ minVersion: '0.0.1', protocolV1MessageSchema: 'protocolV1Legacy' },
|
|
38917
|
+
{ minVersion: '0.0.0', protocolV1MessageSchema: 'protocolV1Current' },
|
|
38914
38918
|
],
|
|
38915
38919
|
model_touch: [
|
|
38916
|
-
{ minVersion: '4.5.0',
|
|
38917
|
-
{ minVersion: '0.0.1',
|
|
38918
|
-
{ minVersion: '0.0.0',
|
|
38920
|
+
{ minVersion: '4.5.0', protocolV1MessageSchema: 'protocolV1Current' },
|
|
38921
|
+
{ minVersion: '0.0.1', protocolV1MessageSchema: 'protocolV1Legacy' },
|
|
38922
|
+
{ minVersion: '0.0.0', protocolV1MessageSchema: 'protocolV1Current' },
|
|
38919
38923
|
],
|
|
38920
38924
|
};
|
|
38921
38925
|
|
|
38922
|
-
const
|
|
38926
|
+
const getSupportProtocolV1MessageSchema = (features) => {
|
|
38923
38927
|
var _a;
|
|
38924
38928
|
if (!features)
|
|
38925
38929
|
return {
|
|
38926
|
-
messages: DataManager.messages.
|
|
38927
|
-
|
|
38930
|
+
messages: DataManager.messages.protocolV1Current,
|
|
38931
|
+
protocolV1MessageSchema: 'protocolV1Current',
|
|
38928
38932
|
};
|
|
38929
38933
|
const currentDeviceVersion = getDeviceFirmwareVersion(features).join('.');
|
|
38930
38934
|
const deviceType = getDeviceType(features);
|
|
@@ -38934,17 +38938,17 @@ const getSupportMessageVersion = (features) => {
|
|
|
38934
38938
|
.map(model => PROTOBUF_MESSAGE_CONFIG[model])
|
|
38935
38939
|
.find(range => range !== undefined));
|
|
38936
38940
|
const sortedDeviceVersionConfigs = (_a = deviceVersionConfigs === null || deviceVersionConfigs === void 0 ? void 0 : deviceVersionConfigs.sort((a, b) => semver__default["default"].compare(b.minVersion, a.minVersion))) !== null && _a !== void 0 ? _a : [];
|
|
38937
|
-
for (const { minVersion,
|
|
38941
|
+
for (const { minVersion, protocolV1MessageSchema } of sortedDeviceVersionConfigs) {
|
|
38938
38942
|
if (semver__default["default"].gte(currentDeviceVersion, minVersion)) {
|
|
38939
38943
|
return {
|
|
38940
|
-
messages: DataManager.messages[
|
|
38941
|
-
|
|
38944
|
+
messages: DataManager.messages[protocolV1MessageSchema],
|
|
38945
|
+
protocolV1MessageSchema,
|
|
38942
38946
|
};
|
|
38943
38947
|
}
|
|
38944
38948
|
}
|
|
38945
38949
|
return {
|
|
38946
|
-
messages: DataManager.messages.
|
|
38947
|
-
|
|
38950
|
+
messages: DataManager.messages.protocolV1Current,
|
|
38951
|
+
protocolV1MessageSchema: 'protocolV1Current',
|
|
38948
38952
|
};
|
|
38949
38953
|
};
|
|
38950
38954
|
const supportInputPinOnSoftware = (features) => {
|
|
@@ -38961,7 +38965,9 @@ const supportNewPassphrase = (features) => {
|
|
|
38961
38965
|
if (!features)
|
|
38962
38966
|
return { support: false };
|
|
38963
38967
|
const deviceType = getDeviceType(features);
|
|
38964
|
-
if (deviceType === hdShared.EDeviceType.Touch ||
|
|
38968
|
+
if (deviceType === hdShared.EDeviceType.Touch ||
|
|
38969
|
+
deviceType === hdShared.EDeviceType.Pro ||
|
|
38970
|
+
deviceType === hdShared.EDeviceType.Pro2) {
|
|
38965
38971
|
return { support: true };
|
|
38966
38972
|
}
|
|
38967
38973
|
const currentVersion = getDeviceFirmwareVersion(features).join('.');
|
|
@@ -38971,15 +38977,23 @@ const getPassphraseStateWithRefreshDeviceInfo = (device, options) => __awaiter(v
|
|
|
38971
38977
|
var _a, _b, _c, _d, _e;
|
|
38972
38978
|
const { features, commands } = device;
|
|
38973
38979
|
const locked = (features === null || features === void 0 ? void 0 : features.unlocked) === false;
|
|
38980
|
+
const deviceType = getDeviceType(features);
|
|
38981
|
+
const isPro2 = deviceType === hdShared.EDeviceType.Pro2;
|
|
38974
38982
|
const { passphraseState, newSession, unlockedAttachPin } = yield getPassphraseState(features, commands, Object.assign({}, options));
|
|
38975
|
-
const isModeT =
|
|
38976
|
-
const needRefreshWithPassphrase = passphraseState && (features === null || features === void 0 ? void 0 : features.passphrase_protection) !== true;
|
|
38983
|
+
const isModeT = deviceType === hdShared.EDeviceType.Touch || deviceType === hdShared.EDeviceType.Pro;
|
|
38984
|
+
const needRefreshWithPassphrase = !isPro2 && passphraseState && (features === null || features === void 0 ? void 0 : features.passphrase_protection) !== true;
|
|
38977
38985
|
const needRefreshWithLocked = isModeT && locked;
|
|
38978
38986
|
if (needRefreshWithLocked || needRefreshWithPassphrase) {
|
|
38979
38987
|
yield device.getFeatures();
|
|
38980
38988
|
}
|
|
38989
|
+
if (isPro2 && device.features && (passphraseState || newSession)) {
|
|
38990
|
+
device.features.passphrase_protection = true;
|
|
38991
|
+
if (newSession) {
|
|
38992
|
+
device.features.session_id = newSession;
|
|
38993
|
+
}
|
|
38994
|
+
}
|
|
38981
38995
|
if (features === null || features === void 0 ? void 0 : features.device_id) {
|
|
38982
|
-
device.updateInternalState((_b = (_a = device.features) === null || _a === void 0 ? void 0 : _a.passphrase_protection) !== null && _b !== void 0 ? _b : false, passphraseState, (_d = (_c = device.features) === null || _c === void 0 ? void 0 : _c.device_id) !== null && _d !== void 0 ? _d : '', newSession, (_e = device.features) === null || _e === void 0 ? void 0 : _e.session_id);
|
|
38996
|
+
device.updateInternalState(((_b = (_a = device.features) === null || _a === void 0 ? void 0 : _a.passphrase_protection) !== null && _b !== void 0 ? _b : false) || isPro2, passphraseState, (_d = (_c = device.features) === null || _c === void 0 ? void 0 : _c.device_id) !== null && _d !== void 0 ? _d : '', newSession, (_e = device.features) === null || _e === void 0 ? void 0 : _e.session_id);
|
|
38983
38997
|
}
|
|
38984
38998
|
return { passphraseState, newSession, unlockedAttachPin };
|
|
38985
38999
|
});
|
|
@@ -38990,6 +39004,7 @@ const getPassphraseState = (features, commands, options) => __awaiter(void 0, vo
|
|
|
38990
39004
|
const deviceType = getDeviceType(features);
|
|
38991
39005
|
const supportAttachPinCapability = existCapability(features, hdTransport.Enum_Capability.Capability_AttachToPin);
|
|
38992
39006
|
const supportGetPassphraseState = supportAttachPinCapability ||
|
|
39007
|
+
deviceType === hdShared.EDeviceType.Pro2 ||
|
|
38993
39008
|
(deviceType === hdShared.EDeviceType.Pro && semver__default["default"].gte(firmwareVersion.join('.'), '4.15.0'));
|
|
38994
39009
|
if (supportGetPassphraseState) {
|
|
38995
39010
|
const { message, type } = yield commands.typedCall('GetPassphraseState', 'PassphraseState', {
|
|
@@ -40135,7 +40150,7 @@ class TransportManager {
|
|
|
40135
40150
|
Log$d.debug('transport manager load');
|
|
40136
40151
|
this.defaultMessages = DataManager.getProtobufMessages();
|
|
40137
40152
|
this.currentMessages = this.defaultMessages;
|
|
40138
|
-
this.
|
|
40153
|
+
this.protocolV1MessageSchema = 'protocolV1Current';
|
|
40139
40154
|
}
|
|
40140
40155
|
static configure() {
|
|
40141
40156
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -40172,7 +40187,7 @@ class TransportManager {
|
|
|
40172
40187
|
Log$d.debug('Configuring transports');
|
|
40173
40188
|
yield this.transport.configure(JSON.stringify(this.defaultMessages));
|
|
40174
40189
|
this.currentMessages = this.defaultMessages;
|
|
40175
|
-
this.
|
|
40190
|
+
this.protocolV1MessageSchema = 'protocolV1Current';
|
|
40176
40191
|
yield this.configureProtocolV2Messages();
|
|
40177
40192
|
Log$d.debug('Configuring transports done');
|
|
40178
40193
|
}
|
|
@@ -40189,15 +40204,15 @@ class TransportManager {
|
|
|
40189
40204
|
if (!features) {
|
|
40190
40205
|
return;
|
|
40191
40206
|
}
|
|
40192
|
-
const {
|
|
40207
|
+
const { protocolV1MessageSchema, messages } = getSupportProtocolV1MessageSchema(features);
|
|
40193
40208
|
if (this.currentMessages === messages || !messages) {
|
|
40194
40209
|
return;
|
|
40195
40210
|
}
|
|
40196
|
-
Log$d.debug(`Reconfiguring transports
|
|
40211
|
+
Log$d.debug(`Reconfiguring transports Protocol V1 schema:${protocolV1MessageSchema}`);
|
|
40197
40212
|
try {
|
|
40198
40213
|
yield this.transport.configure(JSON.stringify(messages));
|
|
40199
40214
|
this.currentMessages = messages;
|
|
40200
|
-
this.
|
|
40215
|
+
this.protocolV1MessageSchema = protocolV1MessageSchema;
|
|
40201
40216
|
}
|
|
40202
40217
|
catch (error) {
|
|
40203
40218
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.TransportInvalidProtobuf, `Transport_InvalidProtobuf: ${error.message}`);
|
|
@@ -40239,12 +40254,12 @@ class TransportManager {
|
|
|
40239
40254
|
static getCurrentMessages() {
|
|
40240
40255
|
return this.currentMessages;
|
|
40241
40256
|
}
|
|
40242
|
-
static
|
|
40243
|
-
return this.
|
|
40257
|
+
static getProtocolV1MessageSchema() {
|
|
40258
|
+
return this.protocolV1MessageSchema;
|
|
40244
40259
|
}
|
|
40245
40260
|
}
|
|
40246
40261
|
TransportManager.reactNativeInit = false;
|
|
40247
|
-
TransportManager.
|
|
40262
|
+
TransportManager.protocolV1MessageSchema = 'protocolV1Current';
|
|
40248
40263
|
TransportManager.plugin = null;
|
|
40249
40264
|
|
|
40250
40265
|
const MAX_DEBUG_ARRAY_ITEMS = 20;
|
|
@@ -40857,7 +40872,7 @@ function createBaseFeatures(descriptor) {
|
|
|
40857
40872
|
bootloader_mode: false,
|
|
40858
40873
|
device_id: descriptorId,
|
|
40859
40874
|
pin_protection: null,
|
|
40860
|
-
passphrase_protection:
|
|
40875
|
+
passphrase_protection: null,
|
|
40861
40876
|
language: null,
|
|
40862
40877
|
label: null,
|
|
40863
40878
|
initialized: false,
|
|
@@ -40916,29 +40931,28 @@ function getProtocolV2Features({ commands, descriptor, timeoutMs, }) {
|
|
|
40916
40931
|
}
|
|
40917
40932
|
|
|
40918
40933
|
const ProtocolV2FirmwareTargetType = {
|
|
40919
|
-
|
|
40920
|
-
|
|
40921
|
-
|
|
40922
|
-
|
|
40923
|
-
|
|
40924
|
-
|
|
40925
|
-
|
|
40934
|
+
TARGET_INVALID: 0,
|
|
40935
|
+
TARGET_ROMLOADER: 1,
|
|
40936
|
+
TARGET_BOOTLOADER: 2,
|
|
40937
|
+
TARGET_FIRMWARE_P1: 3,
|
|
40938
|
+
TARGET_FIRMWARE_P2: 4,
|
|
40939
|
+
TARGET_COPROCESSOR: 5,
|
|
40940
|
+
TARGET_SE: 6,
|
|
40926
40941
|
TARGET_RESOURCE: 10,
|
|
40927
40942
|
};
|
|
40928
40943
|
function protocolV2FileNameToTargetId(fileName) {
|
|
40929
|
-
|
|
40930
|
-
|
|
40931
|
-
|
|
40932
|
-
|
|
40933
|
-
|
|
40934
|
-
|
|
40935
|
-
|
|
40936
|
-
|
|
40937
|
-
|
|
40938
|
-
|
|
40939
|
-
|
|
40940
|
-
|
|
40941
|
-
return ProtocolV2FirmwareTargetType.TARGET_MAIN_APP;
|
|
40944
|
+
const normalized = fileName.toLowerCase();
|
|
40945
|
+
if (normalized.includes('romloader'))
|
|
40946
|
+
return ProtocolV2FirmwareTargetType.TARGET_ROMLOADER;
|
|
40947
|
+
if (normalized.includes('bootloader'))
|
|
40948
|
+
return ProtocolV2FirmwareTargetType.TARGET_BOOTLOADER;
|
|
40949
|
+
if (normalized.includes('ble'))
|
|
40950
|
+
return ProtocolV2FirmwareTargetType.TARGET_COPROCESSOR;
|
|
40951
|
+
if (normalized.includes('se'))
|
|
40952
|
+
return ProtocolV2FirmwareTargetType.TARGET_SE;
|
|
40953
|
+
if (normalized.includes('p2'))
|
|
40954
|
+
return ProtocolV2FirmwareTargetType.TARGET_FIRMWARE_P2;
|
|
40955
|
+
return ProtocolV2FirmwareTargetType.TARGET_FIRMWARE_P1;
|
|
40942
40956
|
}
|
|
40943
40957
|
|
|
40944
40958
|
const parseRunOptions = (options) => {
|
|
@@ -41511,7 +41525,10 @@ class Device extends events.exports {
|
|
|
41511
41525
|
const firmwareVersion = (_a = getDeviceFirmwareVersion(this.features)) === null || _a === void 0 ? void 0 : _a.join('.');
|
|
41512
41526
|
const versionRange = getMethodVersionRange(this.features, type => this.supportUnlockVersionRange()[type]);
|
|
41513
41527
|
const supportAttachPinCapability = existCapability(this.features, hdTransport.Enum_Capability.Capability_AttachToPin);
|
|
41514
|
-
const
|
|
41528
|
+
const isPro2 = getDeviceType(this.features) === hdShared.EDeviceType.Pro2;
|
|
41529
|
+
const supportUnlock = supportAttachPinCapability ||
|
|
41530
|
+
isPro2 ||
|
|
41531
|
+
(versionRange && semver__default["default"].gte(firmwareVersion, versionRange.min));
|
|
41515
41532
|
if (supportUnlock) {
|
|
41516
41533
|
const res = yield this.commands.typedCall('UnLockDevice', 'UnLockDeviceResponse');
|
|
41517
41534
|
if (this.features) {
|
|
@@ -41936,11 +41953,21 @@ class GetPassphraseState extends BaseMethod {
|
|
|
41936
41953
|
this.useDevicePassphraseState = false;
|
|
41937
41954
|
}
|
|
41938
41955
|
run() {
|
|
41956
|
+
var _a, _b;
|
|
41939
41957
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41940
41958
|
if (!this.device.features)
|
|
41941
41959
|
return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInitializeFailed));
|
|
41942
|
-
const { passphraseState } = yield getPassphraseStateWithRefreshDeviceInfo(this.device);
|
|
41960
|
+
const { passphraseState, newSession, unlockedAttachPin } = yield getPassphraseStateWithRefreshDeviceInfo(this.device);
|
|
41943
41961
|
const { features } = this.device;
|
|
41962
|
+
const isPro2 = getDeviceType(features) === hdShared.EDeviceType.Pro2;
|
|
41963
|
+
if (isPro2) {
|
|
41964
|
+
return Promise.resolve({
|
|
41965
|
+
passphrase_state: passphraseState,
|
|
41966
|
+
session_id: (_a = newSession !== null && newSession !== void 0 ? newSession : features === null || features === void 0 ? void 0 : features.session_id) !== null && _a !== void 0 ? _a : undefined,
|
|
41967
|
+
unlocked_attach_pin: unlockedAttachPin,
|
|
41968
|
+
passphrase_protection: (_b = features === null || features === void 0 ? void 0 : features.passphrase_protection) !== null && _b !== void 0 ? _b : null,
|
|
41969
|
+
});
|
|
41970
|
+
}
|
|
41944
41971
|
if (features && features.passphrase_protection === true) {
|
|
41945
41972
|
return Promise.resolve(passphraseState);
|
|
41946
41973
|
}
|
|
@@ -42472,8 +42499,8 @@ class DeviceRebootToBootloader extends BaseMethod {
|
|
|
42472
42499
|
var _a;
|
|
42473
42500
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42474
42501
|
if (((_a = this.device.originalDescriptor) === null || _a === void 0 ? void 0 : _a.protocolType) === 'V2') {
|
|
42475
|
-
const res = yield this.device.commands.typedCall('
|
|
42476
|
-
reboot_type: hdTransport.
|
|
42502
|
+
const res = yield this.device.commands.typedCall('DeviceReboot', 'Success', {
|
|
42503
|
+
reboot_type: hdTransport.DeviceRebootType.Bootloader,
|
|
42477
42504
|
});
|
|
42478
42505
|
return Promise.resolve(res.message);
|
|
42479
42506
|
}
|
|
@@ -42502,8 +42529,8 @@ class DeviceRebootToBoardloader extends BaseMethod {
|
|
|
42502
42529
|
var _a;
|
|
42503
42530
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42504
42531
|
if (((_a = this.device.originalDescriptor) === null || _a === void 0 ? void 0 : _a.protocolType) === 'V2') {
|
|
42505
|
-
const res = yield this.device.commands.typedCall('
|
|
42506
|
-
reboot_type: hdTransport.
|
|
42532
|
+
const res = yield this.device.commands.typedCall('DeviceReboot', 'Success', {
|
|
42533
|
+
reboot_type: hdTransport.DeviceRebootType.Boardloader,
|
|
42507
42534
|
});
|
|
42508
42535
|
return Promise.resolve(res.message);
|
|
42509
42536
|
}
|
|
@@ -44703,18 +44730,18 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
|
|
|
44703
44730
|
}
|
|
44704
44731
|
}
|
|
44705
44732
|
|
|
44706
|
-
const
|
|
44707
|
-
Normal: hdTransport.
|
|
44708
|
-
normal: hdTransport.
|
|
44709
|
-
Boardloader: hdTransport.
|
|
44710
|
-
boardloader: hdTransport.
|
|
44711
|
-
Bootloader: hdTransport.
|
|
44712
|
-
bootloader: hdTransport.
|
|
44733
|
+
const DEVICE_REBOOT_TYPES = {
|
|
44734
|
+
Normal: hdTransport.DeviceRebootType.Normal,
|
|
44735
|
+
normal: hdTransport.DeviceRebootType.Normal,
|
|
44736
|
+
Boardloader: hdTransport.DeviceRebootType.Boardloader,
|
|
44737
|
+
boardloader: hdTransport.DeviceRebootType.Boardloader,
|
|
44738
|
+
Bootloader: hdTransport.DeviceRebootType.Bootloader,
|
|
44739
|
+
bootloader: hdTransport.DeviceRebootType.Bootloader,
|
|
44713
44740
|
};
|
|
44714
44741
|
const PROTOCOL_V2_FIRMWARE_UPDATE_OPTIONS = {
|
|
44715
|
-
intermediateTypes: ['
|
|
44742
|
+
intermediateTypes: ['DeviceFirmwareInstallProgress'],
|
|
44716
44743
|
};
|
|
44717
|
-
const PROTOCOL_V2_FIRMWARE_UPDATE_RESPONSE_TYPES = ['Success', '
|
|
44744
|
+
const PROTOCOL_V2_FIRMWARE_UPDATE_RESPONSE_TYPES = ['Success', 'DeviceFirmwareUpdateStatus'];
|
|
44718
44745
|
function normalizeRebootType(value) {
|
|
44719
44746
|
if (typeof value === 'number')
|
|
44720
44747
|
return value;
|
|
@@ -44722,10 +44749,10 @@ function normalizeRebootType(value) {
|
|
|
44722
44749
|
const numeric = Number(value);
|
|
44723
44750
|
if (Number.isFinite(numeric))
|
|
44724
44751
|
return numeric;
|
|
44725
|
-
if (value in
|
|
44726
|
-
return
|
|
44752
|
+
if (value in DEVICE_REBOOT_TYPES)
|
|
44753
|
+
return DEVICE_REBOOT_TYPES[value];
|
|
44727
44754
|
}
|
|
44728
|
-
return hdTransport.
|
|
44755
|
+
return hdTransport.DeviceRebootType.Normal;
|
|
44729
44756
|
}
|
|
44730
44757
|
function normalizeTargetId(value) {
|
|
44731
44758
|
if (typeof value === 'number')
|
|
@@ -44844,7 +44871,7 @@ const isProtocolV2PollingTransientError = (error) => {
|
|
|
44844
44871
|
const message = getUnknownErrorText(error).toLowerCase();
|
|
44845
44872
|
return (isDeviceDisconnectedError(error) ||
|
|
44846
44873
|
isProtocolV2ReconnectProbeError(error) ||
|
|
44847
|
-
(message.includes('response timeout') && message.includes('
|
|
44874
|
+
(message.includes('response timeout') && message.includes('devicegetfirmwareupdatestatus')) ||
|
|
44848
44875
|
message.includes('device not found') ||
|
|
44849
44876
|
message.includes('transportnotfound'));
|
|
44850
44877
|
};
|
|
@@ -45076,7 +45103,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
45076
45103
|
transferStartTime,
|
|
45077
45104
|
});
|
|
45078
45105
|
targets.push({
|
|
45079
|
-
target_id: ProtocolV2FirmwareTargetType.
|
|
45106
|
+
target_id: ProtocolV2FirmwareTargetType.TARGET_BOOTLOADER,
|
|
45080
45107
|
path: bootloaderPath,
|
|
45081
45108
|
});
|
|
45082
45109
|
}
|
|
@@ -45102,7 +45129,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
45102
45129
|
queryProtocolV2FirmwareUpdateStatus() {
|
|
45103
45130
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45104
45131
|
const typedCall = this.device.getCommands().typedCall.bind(this.device.getCommands());
|
|
45105
|
-
return typedCall('
|
|
45132
|
+
return typedCall('DeviceGetFirmwareUpdateStatus', 'DeviceFirmwareUpdateStatus', {}, {
|
|
45106
45133
|
timeoutMs: PROTOCOL_V2_SHORT_RESPONSE_TIMEOUT,
|
|
45107
45134
|
});
|
|
45108
45135
|
});
|
|
@@ -45140,7 +45167,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
45140
45167
|
if ((startResponse === null || startResponse === void 0 ? void 0 : startResponse.type) === 'Success') {
|
|
45141
45168
|
return;
|
|
45142
45169
|
}
|
|
45143
|
-
if ((startResponse === null || startResponse === void 0 ? void 0 : startResponse.type) === '
|
|
45170
|
+
if ((startResponse === null || startResponse === void 0 ? void 0 : startResponse.type) === 'DeviceFirmwareUpdateStatus') {
|
|
45144
45171
|
const statusTargets = ((_a = startResponse.message.targets) !== null && _a !== void 0 ? _a : []);
|
|
45145
45172
|
if (this.assertProtocolV2TargetStatus(statusTargets, expectedTargetIds)) {
|
|
45146
45173
|
return;
|
|
@@ -45189,7 +45216,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
45189
45216
|
exitProtocolV2BootloaderToNormal() {
|
|
45190
45217
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45191
45218
|
this.postTipMessage(exports.FirmwareUpdateTipMessage.SwitchFirmwareReconnectDevice);
|
|
45192
|
-
yield this.protocolV2Reboot(hdTransport.
|
|
45219
|
+
yield this.protocolV2Reboot(hdTransport.DeviceRebootType.Normal);
|
|
45193
45220
|
});
|
|
45194
45221
|
}
|
|
45195
45222
|
waitForProtocolV2FinalFeatures() {
|
|
@@ -45356,10 +45383,10 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
45356
45383
|
const typedCall = this.device.getCommands().typedCall.bind(this.device.getCommands());
|
|
45357
45384
|
let response;
|
|
45358
45385
|
try {
|
|
45359
|
-
response = yield typedCall('
|
|
45386
|
+
response = yield typedCall('DeviceFirmwareUpdate', PROTOCOL_V2_FIRMWARE_UPDATE_RESPONSE_TYPES, {
|
|
45360
45387
|
targets,
|
|
45361
45388
|
}, {
|
|
45362
|
-
intermediateTypes: ['
|
|
45389
|
+
intermediateTypes: ['DeviceFirmwareInstallProgress'],
|
|
45363
45390
|
onIntermediateResponse: (response) => {
|
|
45364
45391
|
var _a;
|
|
45365
45392
|
const progress = Number((_a = response.message) === null || _a === void 0 ? void 0 : _a.progress);
|
|
@@ -45385,7 +45412,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
45385
45412
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45386
45413
|
const typedCall = this.device.getCommands().typedCall.bind(this.device.getCommands());
|
|
45387
45414
|
try {
|
|
45388
|
-
const res = yield typedCall('
|
|
45415
|
+
const res = yield typedCall('DeviceReboot', 'Success', {
|
|
45389
45416
|
reboot_type: rebootType,
|
|
45390
45417
|
});
|
|
45391
45418
|
return res.message;
|
|
@@ -45494,7 +45521,7 @@ class Ping extends BaseMethod {
|
|
|
45494
45521
|
}
|
|
45495
45522
|
}
|
|
45496
45523
|
|
|
45497
|
-
class
|
|
45524
|
+
class DeviceReboot extends BaseMethod {
|
|
45498
45525
|
init() {
|
|
45499
45526
|
this.skipForceUpdateCheck = true;
|
|
45500
45527
|
this.useDevicePassphraseState = false;
|
|
@@ -45506,7 +45533,7 @@ class DevReboot extends BaseMethod {
|
|
|
45506
45533
|
run() {
|
|
45507
45534
|
var _a;
|
|
45508
45535
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45509
|
-
const res = yield this.device.commands.typedCall('
|
|
45536
|
+
const res = yield this.device.commands.typedCall('DeviceReboot', 'Success', {
|
|
45510
45537
|
reboot_type: normalizeRebootType((_a = this.params.reboot_type) !== null && _a !== void 0 ? _a : this.params.rebootType),
|
|
45511
45538
|
});
|
|
45512
45539
|
return Promise.resolve(res.message);
|
|
@@ -45514,7 +45541,7 @@ class DevReboot extends BaseMethod {
|
|
|
45514
45541
|
}
|
|
45515
45542
|
}
|
|
45516
45543
|
|
|
45517
|
-
class
|
|
45544
|
+
class DeviceGetDeviceInfo extends BaseMethod {
|
|
45518
45545
|
init() {
|
|
45519
45546
|
this.skipForceUpdateCheck = true;
|
|
45520
45547
|
this.useDevicePassphraseState = false;
|
|
@@ -45537,7 +45564,7 @@ class DevGetDeviceInfo extends BaseMethod {
|
|
|
45537
45564
|
}
|
|
45538
45565
|
run() {
|
|
45539
45566
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45540
|
-
const res = yield this.device.commands.typedCall('
|
|
45567
|
+
const res = yield this.device.commands.typedCall('DeviceGetDeviceInfo', 'DeviceInfo', {
|
|
45541
45568
|
targets: buildTargets(this.params),
|
|
45542
45569
|
types: buildTypes(this.params),
|
|
45543
45570
|
});
|
|
@@ -45546,7 +45573,7 @@ class DevGetDeviceInfo extends BaseMethod {
|
|
|
45546
45573
|
}
|
|
45547
45574
|
}
|
|
45548
45575
|
|
|
45549
|
-
class
|
|
45576
|
+
class DeviceGetOnboardingStatus extends BaseMethod {
|
|
45550
45577
|
init() {
|
|
45551
45578
|
this.skipForceUpdateCheck = true;
|
|
45552
45579
|
this.useDevicePassphraseState = false;
|
|
@@ -45554,13 +45581,13 @@ class DevGetOnboardingStatus extends BaseMethod {
|
|
|
45554
45581
|
}
|
|
45555
45582
|
run() {
|
|
45556
45583
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45557
|
-
const res = yield this.device.commands.typedCall('
|
|
45584
|
+
const res = yield this.device.commands.typedCall('DeviceGetOnboardingStatus', 'DeviceOnboardingStatus', {});
|
|
45558
45585
|
return Promise.resolve(res.message);
|
|
45559
45586
|
});
|
|
45560
45587
|
}
|
|
45561
45588
|
}
|
|
45562
45589
|
|
|
45563
|
-
class
|
|
45590
|
+
class DeviceFirmwareUpdate extends BaseMethod {
|
|
45564
45591
|
init() {
|
|
45565
45592
|
this.skipForceUpdateCheck = true;
|
|
45566
45593
|
this.useDevicePassphraseState = false;
|
|
@@ -45573,7 +45600,7 @@ class DevFirmwareUpdate extends BaseMethod {
|
|
|
45573
45600
|
}
|
|
45574
45601
|
run() {
|
|
45575
45602
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45576
|
-
const res = yield this.device.commands.typedCall('
|
|
45603
|
+
const res = yield this.device.commands.typedCall('DeviceFirmwareUpdate', PROTOCOL_V2_FIRMWARE_UPDATE_RESPONSE_TYPES, {
|
|
45577
45604
|
targets: normalizeFirmwareTargets(this.params),
|
|
45578
45605
|
}, PROTOCOL_V2_FIRMWARE_UPDATE_OPTIONS);
|
|
45579
45606
|
return Promise.resolve(res.message);
|
|
@@ -45581,7 +45608,7 @@ class DevFirmwareUpdate extends BaseMethod {
|
|
|
45581
45608
|
}
|
|
45582
45609
|
}
|
|
45583
45610
|
|
|
45584
|
-
class
|
|
45611
|
+
class DeviceGetFirmwareUpdateStatus extends BaseMethod {
|
|
45585
45612
|
init() {
|
|
45586
45613
|
this.skipForceUpdateCheck = true;
|
|
45587
45614
|
this.useDevicePassphraseState = false;
|
|
@@ -45589,7 +45616,7 @@ class DevGetFirmwareUpdateStatus extends BaseMethod {
|
|
|
45589
45616
|
}
|
|
45590
45617
|
run() {
|
|
45591
45618
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45592
|
-
const res = yield this.device.commands.typedCall('
|
|
45619
|
+
const res = yield this.device.commands.typedCall('DeviceGetFirmwareUpdateStatus', 'DeviceFirmwareUpdateStatus', {});
|
|
45593
45620
|
return Promise.resolve(res.message);
|
|
45594
45621
|
});
|
|
45595
45622
|
}
|
|
@@ -46393,10 +46420,16 @@ function preCheckDeviceSupport(device, method) {
|
|
|
46393
46420
|
}
|
|
46394
46421
|
}
|
|
46395
46422
|
function handleSkippableHardwareError(e, device, method) {
|
|
46396
|
-
var _a, _b, _c, _d, _e, _f;
|
|
46423
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
46397
46424
|
let error;
|
|
46425
|
+
const skipMethodSupportCheck = shouldSkipMethodSupportCheck(device.features, (_a = device.originalDescriptor) === null || _a === void 0 ? void 0 : _a.protocolType);
|
|
46398
46426
|
if (e instanceof hdShared.HardwareError && e.errorCode !== hdShared.HardwareErrorCode.RuntimeError) {
|
|
46399
46427
|
const { errorCode } = e;
|
|
46428
|
+
if (skipMethodSupportCheck &&
|
|
46429
|
+
(errorCode === hdShared.HardwareErrorCode.CallMethodNeedUpgradeFirmware ||
|
|
46430
|
+
errorCode === hdShared.HardwareErrorCode.DeviceNotSupportMethod)) {
|
|
46431
|
+
return undefined;
|
|
46432
|
+
}
|
|
46400
46433
|
if (errorCode === hdShared.HardwareErrorCode.CallMethodNeedUpgradeFirmware) {
|
|
46401
46434
|
error = e;
|
|
46402
46435
|
}
|
|
@@ -46404,8 +46437,11 @@ function handleSkippableHardwareError(e, device, method) {
|
|
|
46404
46437
|
error = e;
|
|
46405
46438
|
}
|
|
46406
46439
|
}
|
|
46407
|
-
else if (((
|
|
46408
|
-
((
|
|
46440
|
+
else if (((_b = e.message) === null || _b === void 0 ? void 0 : _b.includes('Failure_UnexpectedMessage')) ||
|
|
46441
|
+
((_c = e.message) === null || _c === void 0 ? void 0 : _c.includes('Failure_UnknownMessage'))) {
|
|
46442
|
+
if (skipMethodSupportCheck) {
|
|
46443
|
+
return undefined;
|
|
46444
|
+
}
|
|
46409
46445
|
const versionRange = getMethodVersionRange(device.features, type => method.getVersionRange()[type]);
|
|
46410
46446
|
const currentVersion = getDeviceFirmwareVersion(device.features).join('.');
|
|
46411
46447
|
if (versionRange &&
|
|
@@ -46422,8 +46458,8 @@ function handleSkippableHardwareError(e, device, method) {
|
|
|
46422
46458
|
error = hdShared.ERRORS.createDeviceNotSupportMethodError(method.name, getFirmwareType(device.features));
|
|
46423
46459
|
}
|
|
46424
46460
|
}
|
|
46425
|
-
else if (((
|
|
46426
|
-
((
|
|
46461
|
+
else if (((_e = (_d = e.message) === null || _d === void 0 ? void 0 : _d.toLowerCase()) === null || _e === void 0 ? void 0 : _e.includes('forbidden key path')) ||
|
|
46462
|
+
((_g = (_f = e.message) === null || _f === void 0 ? void 0 : _f.toLowerCase()) === null || _g === void 0 ? void 0 : _g.includes('invalid path'))) {
|
|
46427
46463
|
error = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, e.message);
|
|
46428
46464
|
}
|
|
46429
46465
|
return error;
|
|
@@ -46936,13 +46972,14 @@ function splitArray(array, size) {
|
|
|
46936
46972
|
}
|
|
46937
46973
|
|
|
46938
46974
|
function batchGetPublickeys(device, paths, ecdsaCurveName, coinType, options) {
|
|
46939
|
-
var _a;
|
|
46975
|
+
var _a, _b;
|
|
46940
46976
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46941
46977
|
const existsPathNotValid = paths.find(p => p.address_n.length < 3);
|
|
46942
46978
|
if (existsPathNotValid) {
|
|
46943
46979
|
throw hdShared.TypedError(hdShared.HardwareErrorCode.ForbiddenKeyPath, 'Path length must be greater than 3');
|
|
46944
46980
|
}
|
|
46945
|
-
const supportsBatchPublicKey =
|
|
46981
|
+
const supportsBatchPublicKey = shouldSkipMethodSupportCheck(device.features, (_a = device.originalDescriptor) === null || _a === void 0 ? void 0 : _a.protocolType) ||
|
|
46982
|
+
supportBatchPublicKey(device.features, options);
|
|
46946
46983
|
if (!supportsBatchPublicKey) {
|
|
46947
46984
|
throw hdShared.createDeviceNotSupportMethodError('BatchGetPublickeys', getFirmwareType(device.features));
|
|
46948
46985
|
}
|
|
@@ -46967,7 +47004,7 @@ function batchGetPublickeys(device, paths, ecdsaCurveName, coinType, options) {
|
|
|
46967
47004
|
const res = yield device.commands.typedCall('BatchGetPublickeys', 'EcdsaPublicKeys', {
|
|
46968
47005
|
paths,
|
|
46969
47006
|
ecdsa_curve_name: ecdsaCurveName,
|
|
46970
|
-
include_node: (
|
|
47007
|
+
include_node: (_b = options === null || options === void 0 ? void 0 : options.includeNode) !== null && _b !== void 0 ? _b : false,
|
|
46971
47008
|
});
|
|
46972
47009
|
if (res.type !== 'EcdsaPublicKeys') {
|
|
46973
47010
|
throw hdShared.createDeviceNotSupportMethodError('BatchGetPublickeys', getFirmwareType(device.features));
|
|
@@ -47873,7 +47910,7 @@ class ConfluxSignTransaction extends BaseMethod {
|
|
|
47873
47910
|
this.addressN = validatePath(path, 3);
|
|
47874
47911
|
const tx = transaction;
|
|
47875
47912
|
const schema = [
|
|
47876
|
-
{ name: 'to', type: '
|
|
47913
|
+
{ name: 'to', type: 'string', required: true },
|
|
47877
47914
|
{ name: 'value', type: 'hexString', required: true },
|
|
47878
47915
|
{ name: 'gasLimit', type: 'hexString', required: true },
|
|
47879
47916
|
{ name: 'gasPrice', type: 'hexString', required: true },
|
|
@@ -47884,7 +47921,7 @@ class ConfluxSignTransaction extends BaseMethod {
|
|
|
47884
47921
|
{ name: 'data', type: 'hexString' },
|
|
47885
47922
|
];
|
|
47886
47923
|
validateParams(tx, schema);
|
|
47887
|
-
this.formattedTx = formatAnyHex(tx);
|
|
47924
|
+
this.formattedTx = Object.assign(Object.assign({}, formatAnyHex(tx)), { to: tx.to });
|
|
47888
47925
|
}
|
|
47889
47926
|
getVersionRange() {
|
|
47890
47927
|
return {
|
|
@@ -47952,7 +47989,7 @@ class EvmGetAddress extends BaseMethod {
|
|
|
47952
47989
|
}
|
|
47953
47990
|
getEvmAddress(param) {
|
|
47954
47991
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47955
|
-
if (TransportManager.
|
|
47992
|
+
if (TransportManager.getProtocolV1MessageSchema() === 'protocolV1Legacy') {
|
|
47956
47993
|
return getAddressLegacyV1({
|
|
47957
47994
|
typedCall: this.device.commands.typedCall.bind(this.device.commands),
|
|
47958
47995
|
param,
|
|
@@ -48039,7 +48076,7 @@ class EVMGetPublicKey extends BaseMethod {
|
|
|
48039
48076
|
});
|
|
48040
48077
|
}
|
|
48041
48078
|
getEvmPublicKey(param) {
|
|
48042
|
-
if (TransportManager.
|
|
48079
|
+
if (TransportManager.getProtocolV1MessageSchema() === 'protocolV1Legacy') {
|
|
48043
48080
|
return getPublicKeyLegacyV1({
|
|
48044
48081
|
typedCall: this.device.commands.typedCall.bind(this.device.commands),
|
|
48045
48082
|
param,
|
|
@@ -48123,7 +48160,7 @@ class EVMSignMessage$2 extends BaseMethod {
|
|
|
48123
48160
|
}
|
|
48124
48161
|
run() {
|
|
48125
48162
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48126
|
-
if (TransportManager.
|
|
48163
|
+
if (TransportManager.getProtocolV1MessageSchema() === 'protocolV1Legacy') {
|
|
48127
48164
|
return signMessageLegacyV1({
|
|
48128
48165
|
typedCall: this.device.commands.typedCall.bind(this.device.commands),
|
|
48129
48166
|
params: this.params,
|
|
@@ -48436,7 +48473,7 @@ class EVMSignTransaction extends BaseMethod {
|
|
|
48436
48473
|
const { addressN, isEIP1559, isEIP7702, formattedTx } = this;
|
|
48437
48474
|
if (formattedTx == null)
|
|
48438
48475
|
throw hdShared.ERRORS.TypedError('Runtime', 'formattedTx is not set');
|
|
48439
|
-
if (TransportManager.
|
|
48476
|
+
if (TransportManager.getProtocolV1MessageSchema() === 'protocolV1Legacy') {
|
|
48440
48477
|
return signTransaction({
|
|
48441
48478
|
typedCall: this.device.commands.typedCall.bind(this.device.commands),
|
|
48442
48479
|
addressN,
|
|
@@ -48782,8 +48819,8 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
48782
48819
|
const { addressN, data, metamaskV4Compat, chainId } = this.params;
|
|
48783
48820
|
let supportTrezor = false;
|
|
48784
48821
|
let response;
|
|
48785
|
-
switch (TransportManager.
|
|
48786
|
-
case '
|
|
48822
|
+
switch (TransportManager.getProtocolV1MessageSchema()) {
|
|
48823
|
+
case 'protocolV1Legacy':
|
|
48787
48824
|
supportTrezor = true;
|
|
48788
48825
|
response = yield signTypedData$1({
|
|
48789
48826
|
typedCall: this.device.commands.typedCall.bind(this.device.commands),
|
|
@@ -48793,7 +48830,7 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
48793
48830
|
chainId,
|
|
48794
48831
|
});
|
|
48795
48832
|
break;
|
|
48796
|
-
case '
|
|
48833
|
+
case 'protocolV1Current':
|
|
48797
48834
|
default:
|
|
48798
48835
|
supportTrezor = false;
|
|
48799
48836
|
response = yield signTypedData({
|
|
@@ -48816,8 +48853,8 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
48816
48853
|
signTypedHash({ typedCall, addressN, chainId, domainHash, messageHash, }) {
|
|
48817
48854
|
if (!domainHash)
|
|
48818
48855
|
throw hdShared.ERRORS.TypedError('Runtime', 'domainHash is required');
|
|
48819
|
-
switch (TransportManager.
|
|
48820
|
-
case '
|
|
48856
|
+
switch (TransportManager.getProtocolV1MessageSchema()) {
|
|
48857
|
+
case 'protocolV1Legacy':
|
|
48821
48858
|
return signTypedHash$1({
|
|
48822
48859
|
typedCall,
|
|
48823
48860
|
addressN,
|
|
@@ -48826,7 +48863,7 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
48826
48863
|
chainId,
|
|
48827
48864
|
device: this.device,
|
|
48828
48865
|
});
|
|
48829
|
-
case '
|
|
48866
|
+
case 'protocolV1Current':
|
|
48830
48867
|
default:
|
|
48831
48868
|
return signTypedHash({
|
|
48832
48869
|
typedCall,
|
|
@@ -49087,7 +49124,7 @@ class EVMSignMessage$1 extends BaseMethod {
|
|
|
49087
49124
|
}
|
|
49088
49125
|
run() {
|
|
49089
49126
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49090
|
-
if (TransportManager.
|
|
49127
|
+
if (TransportManager.getProtocolV1MessageSchema() === 'protocolV1Legacy') {
|
|
49091
49128
|
return verifyMessageLegacyV1({
|
|
49092
49129
|
typedCall: this.device.commands.typedCall.bind(this.device.commands),
|
|
49093
49130
|
params: this.params,
|
|
@@ -50088,6 +50125,7 @@ class TronGetAddress extends BaseMethod {
|
|
|
50088
50125
|
|
|
50089
50126
|
class TronSignMessage extends BaseMethod {
|
|
50090
50127
|
init() {
|
|
50128
|
+
var _a;
|
|
50091
50129
|
this.checkDeviceId = true;
|
|
50092
50130
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
50093
50131
|
validateParams(this.payload, [
|
|
@@ -50098,7 +50136,7 @@ class TronSignMessage extends BaseMethod {
|
|
|
50098
50136
|
const { path, messageHex } = this.payload;
|
|
50099
50137
|
const addressN = validatePath(path, 3);
|
|
50100
50138
|
if (this.payload.messageType === 'V1' || this.payload.messageType == null) {
|
|
50101
|
-
throw hdShared.createDeviceNotSupportMethodError('TronSignMessage', getFirmwareType(this.device.features));
|
|
50139
|
+
throw hdShared.createDeviceNotSupportMethodError('TronSignMessage', getFirmwareType((_a = this.device) === null || _a === void 0 ? void 0 : _a.features));
|
|
50102
50140
|
}
|
|
50103
50141
|
const messageType = hdTransport.TronMessageType.V2;
|
|
50104
50142
|
this.params = {
|
|
@@ -51053,7 +51091,7 @@ class XrpGetAddress extends BaseMethod {
|
|
|
51053
51091
|
{ name: 'payment', type: 'object' },
|
|
51054
51092
|
]);
|
|
51055
51093
|
validateParams(transaction.payment, [
|
|
51056
|
-
{ name: 'amount', type: '
|
|
51094
|
+
{ name: 'amount', type: 'uint', required: true },
|
|
51057
51095
|
{ name: 'destination', type: 'string', required: true },
|
|
51058
51096
|
{ name: 'destinationTag', type: 'number' },
|
|
51059
51097
|
]);
|
|
@@ -53755,7 +53793,11 @@ class DnxGetAddress extends BaseMethod {
|
|
|
53755
53793
|
};
|
|
53756
53794
|
}
|
|
53757
53795
|
run() {
|
|
53796
|
+
var _a;
|
|
53758
53797
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53798
|
+
if (((_a = this.device.originalDescriptor) === null || _a === void 0 ? void 0 : _a.protocolType) === 'V2') {
|
|
53799
|
+
throw hdShared.createDeviceNotSupportMethodError(this.name, getFirmwareType(this.device.features));
|
|
53800
|
+
}
|
|
53759
53801
|
const responses = [];
|
|
53760
53802
|
for (let i = 0; i < this.params.length; i++) {
|
|
53761
53803
|
const param = this.params[i];
|
|
@@ -53859,7 +53901,11 @@ class DnxSignTransaction extends BaseMethod {
|
|
|
53859
53901
|
});
|
|
53860
53902
|
}
|
|
53861
53903
|
run() {
|
|
53904
|
+
var _a;
|
|
53862
53905
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53906
|
+
if (((_a = this.device.originalDescriptor) === null || _a === void 0 ? void 0 : _a.protocolType) === 'V2') {
|
|
53907
|
+
throw hdShared.createDeviceNotSupportMethodError(this.name, getFirmwareType(this.device.features));
|
|
53908
|
+
}
|
|
53863
53909
|
const typedCall = this.device.getCommands().typedCall.bind(this.device.getCommands());
|
|
53864
53910
|
const res = yield this.device.commands.typedCall('DnxSignTx', 'DnxInputRequest', Object.assign({}, this.params));
|
|
53865
53911
|
return this.processTxRequest(typedCall, res, {});
|
|
@@ -54937,11 +54983,11 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
|
|
|
54937
54983
|
promptWebDeviceAccess: PromptWebDeviceAccess,
|
|
54938
54984
|
getProtoVersion: GetProtoVersion,
|
|
54939
54985
|
ping: Ping,
|
|
54940
|
-
|
|
54941
|
-
|
|
54942
|
-
|
|
54943
|
-
|
|
54944
|
-
|
|
54986
|
+
deviceReboot: DeviceReboot,
|
|
54987
|
+
deviceGetDeviceInfo: DeviceGetDeviceInfo,
|
|
54988
|
+
deviceGetOnboardingStatus: DeviceGetOnboardingStatus,
|
|
54989
|
+
deviceFirmwareUpdate: DeviceFirmwareUpdate,
|
|
54990
|
+
deviceGetFirmwareUpdateStatus: DeviceGetFirmwareUpdateStatus,
|
|
54945
54991
|
factoryDeviceInfoSettings: FactoryDeviceInfoSettings,
|
|
54946
54992
|
factoryGetDeviceInfo: FactoryGetDeviceInfo,
|
|
54947
54993
|
filesystemFixPermission: FilesystemFixPermission,
|
|
@@ -55982,6 +56028,7 @@ const cancel = (context, connectId) => {
|
|
|
55982
56028
|
const checkPassphraseEnableState = (method, features) => {
|
|
55983
56029
|
if (!method.useDevicePassphraseState)
|
|
55984
56030
|
return;
|
|
56031
|
+
const isPro2 = getDeviceType(features) === hdShared.EDeviceType.Pro2;
|
|
55985
56032
|
if ((features === null || features === void 0 ? void 0 : features.passphrase_protection) === true) {
|
|
55986
56033
|
const hasNoPassphraseState = method.payload.passphraseState == null || method.payload.passphraseState === '';
|
|
55987
56034
|
const shouldRequirePassphrase = !method.payload.useEmptyPassphrase && !method.payload.skipPassphraseCheck;
|
|
@@ -55990,7 +56037,7 @@ const checkPassphraseEnableState = (method, features) => {
|
|
|
55990
56037
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceOpenedPassphrase);
|
|
55991
56038
|
}
|
|
55992
56039
|
}
|
|
55993
|
-
if ((features === null || features === void 0 ? void 0 : features.passphrase_protection) === false && method.payload.passphraseState) {
|
|
56040
|
+
if ((features === null || features === void 0 ? void 0 : features.passphrase_protection) === false && method.payload.passphraseState && !isPro2) {
|
|
55994
56041
|
DevicePool.clearDeviceCache(method.payload.connectId);
|
|
55995
56042
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotOpenedPassphrase);
|
|
55996
56043
|
}
|