@onekeyfe/hd-transport 1.2.0-alpha.183 → 1.2.0-alpha.185
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/README.md +1 -1
- package/__tests__/messages.test.js +25 -0
- package/__tests__/protocol-v2.test.js +15 -0
- package/dist/index.d.ts +52 -3
- package/dist/index.js +9 -2
- package/dist/protocols/v2/session.d.ts +2 -1
- package/dist/protocols/v2/session.d.ts.map +1 -1
- package/dist/types/messages.d.ts +38 -1
- package/dist/types/messages.d.ts.map +1 -1
- package/messages-protocol-v2.json +111 -1
- package/package.json +2 -2
- package/src/protocols/v2/session.ts +3 -1
- package/src/types/messages.ts +47 -1
|
@@ -446,6 +446,9 @@
|
|
|
446
446
|
"MessageType_DeviceCertificateSignature": 60423,
|
|
447
447
|
"MessageType_DeviceCertificateSign": 60424,
|
|
448
448
|
"MessageType_DeviceMiscUsbMscControl": 60440,
|
|
449
|
+
"MessageType_DeviceFindMyTokenState": 60450,
|
|
450
|
+
"MessageType_DeviceFindMyTokenUpdate": 60451,
|
|
451
|
+
"MessageType_DeviceFindMyTokenStateGet": 60452,
|
|
449
452
|
"MessageType_DeviceInfoGet": 60600,
|
|
450
453
|
"MessageType_DeviceInfo": 60601,
|
|
451
454
|
"MessageType_DeviceStatusGet": 60602,
|
|
@@ -5404,6 +5407,10 @@
|
|
|
5404
5407
|
"request_id": {
|
|
5405
5408
|
"type": "bytes",
|
|
5406
5409
|
"id": 5
|
|
5410
|
+
},
|
|
5411
|
+
"source_fingerprint": {
|
|
5412
|
+
"type": "uint32",
|
|
5413
|
+
"id": 6
|
|
5407
5414
|
}
|
|
5408
5415
|
}
|
|
5409
5416
|
},
|
|
@@ -5539,6 +5546,14 @@
|
|
|
5539
5546
|
"tx_type": {
|
|
5540
5547
|
"type": "uint32",
|
|
5541
5548
|
"id": 10
|
|
5549
|
+
},
|
|
5550
|
+
"expected_address": {
|
|
5551
|
+
"type": "bytes",
|
|
5552
|
+
"id": 12
|
|
5553
|
+
},
|
|
5554
|
+
"source_fingerprint": {
|
|
5555
|
+
"type": "uint32",
|
|
5556
|
+
"id": 13
|
|
5542
5557
|
}
|
|
5543
5558
|
}
|
|
5544
5559
|
},
|
|
@@ -5619,6 +5634,14 @@
|
|
|
5619
5634
|
"rule": "repeated",
|
|
5620
5635
|
"type": "EthereumAccessListOneKey",
|
|
5621
5636
|
"id": 11
|
|
5637
|
+
},
|
|
5638
|
+
"expected_address": {
|
|
5639
|
+
"type": "bytes",
|
|
5640
|
+
"id": 12
|
|
5641
|
+
},
|
|
5642
|
+
"source_fingerprint": {
|
|
5643
|
+
"type": "uint32",
|
|
5644
|
+
"id": 13
|
|
5622
5645
|
}
|
|
5623
5646
|
}
|
|
5624
5647
|
},
|
|
@@ -5795,6 +5818,10 @@
|
|
|
5795
5818
|
"chain_id": {
|
|
5796
5819
|
"type": "uint64",
|
|
5797
5820
|
"id": 3
|
|
5821
|
+
},
|
|
5822
|
+
"source_fingerprint": {
|
|
5823
|
+
"type": "uint32",
|
|
5824
|
+
"id": 4
|
|
5798
5825
|
}
|
|
5799
5826
|
}
|
|
5800
5827
|
},
|
|
@@ -9474,6 +9501,10 @@
|
|
|
9474
9501
|
"rule": "required",
|
|
9475
9502
|
"type": "bytes",
|
|
9476
9503
|
"id": 2
|
|
9504
|
+
},
|
|
9505
|
+
"source_fingerprint": {
|
|
9506
|
+
"type": "uint32",
|
|
9507
|
+
"id": 3
|
|
9477
9508
|
}
|
|
9478
9509
|
}
|
|
9479
9510
|
},
|
|
@@ -9518,6 +9549,10 @@
|
|
|
9518
9549
|
"application_domain": {
|
|
9519
9550
|
"type": "bytes",
|
|
9520
9551
|
"id": 5
|
|
9552
|
+
},
|
|
9553
|
+
"source_fingerprint": {
|
|
9554
|
+
"type": "uint32",
|
|
9555
|
+
"id": 6
|
|
9521
9556
|
}
|
|
9522
9557
|
}
|
|
9523
9558
|
},
|
|
@@ -9535,6 +9570,10 @@
|
|
|
9535
9570
|
"rule": "required",
|
|
9536
9571
|
"type": "bytes",
|
|
9537
9572
|
"id": 2
|
|
9573
|
+
},
|
|
9574
|
+
"source_fingerprint": {
|
|
9575
|
+
"type": "uint32",
|
|
9576
|
+
"id": 3
|
|
9538
9577
|
}
|
|
9539
9578
|
}
|
|
9540
9579
|
},
|
|
@@ -11764,6 +11803,27 @@
|
|
|
11764
11803
|
}
|
|
11765
11804
|
}
|
|
11766
11805
|
},
|
|
11806
|
+
"DeviceFindMyTokenUpdate": {
|
|
11807
|
+
"fields": {
|
|
11808
|
+
"token": {
|
|
11809
|
+
"rule": "required",
|
|
11810
|
+
"type": "bytes",
|
|
11811
|
+
"id": 1
|
|
11812
|
+
}
|
|
11813
|
+
}
|
|
11814
|
+
},
|
|
11815
|
+
"DeviceFindMyTokenStateGet": {
|
|
11816
|
+
"fields": {}
|
|
11817
|
+
},
|
|
11818
|
+
"DeviceFindMyTokenState": {
|
|
11819
|
+
"fields": {
|
|
11820
|
+
"burned": {
|
|
11821
|
+
"rule": "required",
|
|
11822
|
+
"type": "bool",
|
|
11823
|
+
"id": 1
|
|
11824
|
+
}
|
|
11825
|
+
}
|
|
11826
|
+
},
|
|
11767
11827
|
"DeviceFactoryAck": {
|
|
11768
11828
|
"values": {
|
|
11769
11829
|
"FACTORY_ACK_SUCCESS": 0,
|
|
@@ -11893,6 +11953,13 @@
|
|
|
11893
11953
|
"FW_MGMT_UPDATER_TASK_STATUS_FAILED_ENTRY_OUT_OF_BOUNDS": 10
|
|
11894
11954
|
}
|
|
11895
11955
|
},
|
|
11956
|
+
"DeviceFirmwareUpdatePhase": {
|
|
11957
|
+
"values": {
|
|
11958
|
+
"FW_MGMT_UPDATER_PHASE_PREPARE": 0,
|
|
11959
|
+
"FW_MGMT_UPDATER_PHASE_INSTALL": 1,
|
|
11960
|
+
"FW_MGMT_UPDATER_PHASE_VERIFY": 2
|
|
11961
|
+
}
|
|
11962
|
+
},
|
|
11896
11963
|
"DeviceFirmwareTarget": {
|
|
11897
11964
|
"fields": {
|
|
11898
11965
|
"target_id": {
|
|
@@ -11917,7 +11984,26 @@
|
|
|
11917
11984
|
}
|
|
11918
11985
|
},
|
|
11919
11986
|
"DeviceFirmwareUpdateRequest": {
|
|
11920
|
-
"fields": {
|
|
11987
|
+
"fields": {
|
|
11988
|
+
"reboot_after_update": {
|
|
11989
|
+
"type": "bool",
|
|
11990
|
+
"id": 1
|
|
11991
|
+
}
|
|
11992
|
+
}
|
|
11993
|
+
},
|
|
11994
|
+
"DeviceFirmwareUpdatePhaseInfo": {
|
|
11995
|
+
"fields": {
|
|
11996
|
+
"phase": {
|
|
11997
|
+
"rule": "required",
|
|
11998
|
+
"type": "DeviceFirmwareUpdatePhase",
|
|
11999
|
+
"id": 1
|
|
12000
|
+
},
|
|
12001
|
+
"progress_percent": {
|
|
12002
|
+
"rule": "required",
|
|
12003
|
+
"type": "uint32",
|
|
12004
|
+
"id": 2
|
|
12005
|
+
}
|
|
12006
|
+
}
|
|
11921
12007
|
},
|
|
11922
12008
|
"DeviceFirmwareUpdateRecord": {
|
|
11923
12009
|
"fields": {
|
|
@@ -11930,6 +12016,14 @@
|
|
|
11930
12016
|
"type": "DeviceFirmwareUpdateTaskStatus",
|
|
11931
12017
|
"id": 10
|
|
11932
12018
|
},
|
|
12019
|
+
"progress_percent": {
|
|
12020
|
+
"type": "uint32",
|
|
12021
|
+
"id": 11
|
|
12022
|
+
},
|
|
12023
|
+
"phase_info": {
|
|
12024
|
+
"type": "DeviceFirmwareUpdatePhaseInfo",
|
|
12025
|
+
"id": 12
|
|
12026
|
+
},
|
|
11933
12027
|
"payload_version": {
|
|
11934
12028
|
"type": "uint32",
|
|
11935
12029
|
"id": 20
|
|
@@ -11946,6 +12040,14 @@
|
|
|
11946
12040
|
"type": "bool",
|
|
11947
12041
|
"id": 10
|
|
11948
12042
|
},
|
|
12043
|
+
"progress_percent": {
|
|
12044
|
+
"type": "bool",
|
|
12045
|
+
"id": 11
|
|
12046
|
+
},
|
|
12047
|
+
"phase_info": {
|
|
12048
|
+
"type": "bool",
|
|
12049
|
+
"id": 12
|
|
12050
|
+
},
|
|
11949
12051
|
"payload_version": {
|
|
11950
12052
|
"type": "bool",
|
|
11951
12053
|
"id": 20
|
|
@@ -12713,6 +12815,10 @@
|
|
|
12713
12815
|
"text_id": {
|
|
12714
12816
|
"type": "uint32",
|
|
12715
12817
|
"id": 3
|
|
12818
|
+
},
|
|
12819
|
+
"text_arg": {
|
|
12820
|
+
"type": "string",
|
|
12821
|
+
"id": 4
|
|
12716
12822
|
}
|
|
12717
12823
|
}
|
|
12718
12824
|
},
|
|
@@ -12780,6 +12886,10 @@
|
|
|
12780
12886
|
"title_id": {
|
|
12781
12887
|
"type": "uint32",
|
|
12782
12888
|
"id": 8
|
|
12889
|
+
},
|
|
12890
|
+
"title_arg": {
|
|
12891
|
+
"type": "string",
|
|
12892
|
+
"id": 9
|
|
12783
12893
|
}
|
|
12784
12894
|
}
|
|
12785
12895
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-transport",
|
|
3
|
-
"version": "1.2.0-alpha.
|
|
3
|
+
"version": "1.2.0-alpha.185",
|
|
4
4
|
"description": "Transport layer abstractions and utilities for OneKey hardware SDK.",
|
|
5
5
|
"author": "OneKey",
|
|
6
6
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"long": "^4.0.0",
|
|
29
29
|
"protobufjs": "^6.11.2"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "dba45132513abeef33dc448824b4eaace74900ee"
|
|
32
32
|
}
|
|
@@ -468,6 +468,7 @@ export async function probeProtocolV2({
|
|
|
468
468
|
logPrefix = 'ProtocolV2',
|
|
469
469
|
onBeforeProbe,
|
|
470
470
|
onProbeFailed,
|
|
471
|
+
shouldRethrow,
|
|
471
472
|
}: {
|
|
472
473
|
call: (
|
|
473
474
|
name: string,
|
|
@@ -479,6 +480,7 @@ export async function probeProtocolV2({
|
|
|
479
480
|
logPrefix?: string;
|
|
480
481
|
onBeforeProbe?: () => Promise<void> | void;
|
|
481
482
|
onProbeFailed?: (error: unknown) => Promise<void> | void;
|
|
483
|
+
shouldRethrow?: (error: unknown) => boolean;
|
|
482
484
|
}) {
|
|
483
485
|
let probeError: unknown;
|
|
484
486
|
try {
|
|
@@ -503,7 +505,7 @@ export async function probeProtocolV2({
|
|
|
503
505
|
}
|
|
504
506
|
probeError = new Error(`unexpected response type ${response.type}`);
|
|
505
507
|
} catch (error) {
|
|
506
|
-
if (isProtocolV2LinkDisabledError(error)) {
|
|
508
|
+
if (isProtocolV2LinkDisabledError(error) || shouldRethrow?.(error)) {
|
|
507
509
|
throw error;
|
|
508
510
|
}
|
|
509
511
|
probeError = error;
|
package/src/types/messages.ts
CHANGED
|
@@ -1950,6 +1950,8 @@ export type EthereumSignTxOneKey = {
|
|
|
1950
1950
|
data_length?: number;
|
|
1951
1951
|
chain_id: number;
|
|
1952
1952
|
tx_type?: number;
|
|
1953
|
+
expected_address?: string;
|
|
1954
|
+
source_fingerprint?: number;
|
|
1953
1955
|
};
|
|
1954
1956
|
|
|
1955
1957
|
// EthereumAccessListOneKey
|
|
@@ -1971,6 +1973,8 @@ export type EthereumSignTxEIP1559OneKey = {
|
|
|
1971
1973
|
data_length: number;
|
|
1972
1974
|
chain_id: number;
|
|
1973
1975
|
access_list: EthereumAccessListOneKey[];
|
|
1976
|
+
expected_address?: string;
|
|
1977
|
+
source_fingerprint?: number;
|
|
1974
1978
|
};
|
|
1975
1979
|
|
|
1976
1980
|
// EthereumAuthorizationSignature
|
|
@@ -2023,6 +2027,7 @@ export type EthereumSignMessageOneKey = {
|
|
|
2023
2027
|
address_n: number[];
|
|
2024
2028
|
message: string;
|
|
2025
2029
|
chain_id?: number;
|
|
2030
|
+
source_fingerprint?: number;
|
|
2026
2031
|
};
|
|
2027
2032
|
|
|
2028
2033
|
// EthereumMessageSignatureOneKey
|
|
@@ -3815,6 +3820,7 @@ export type SolanaSignTx = {
|
|
|
3815
3820
|
address_n: number[];
|
|
3816
3821
|
raw_tx: string;
|
|
3817
3822
|
extra_info?: SolanaTxExtraInfo;
|
|
3823
|
+
source_fingerprint?: number;
|
|
3818
3824
|
};
|
|
3819
3825
|
|
|
3820
3826
|
// SolanaSignedTx
|
|
@@ -3838,12 +3844,14 @@ export type SolanaSignOffChainMessage = {
|
|
|
3838
3844
|
message_version?: SolanaOffChainMessageVersion;
|
|
3839
3845
|
message_format?: SolanaOffChainMessageFormat;
|
|
3840
3846
|
application_domain?: string;
|
|
3847
|
+
source_fingerprint?: number;
|
|
3841
3848
|
};
|
|
3842
3849
|
|
|
3843
3850
|
// SolanaSignUnsafeMessage
|
|
3844
3851
|
export type SolanaSignUnsafeMessage = {
|
|
3845
3852
|
address_n: number[];
|
|
3846
3853
|
message: string;
|
|
3854
|
+
source_fingerprint?: number;
|
|
3847
3855
|
};
|
|
3848
3856
|
|
|
3849
3857
|
// SolanaMessageSignature
|
|
@@ -4594,6 +4602,7 @@ export type EthereumSignTypedDataQR = {
|
|
|
4594
4602
|
chain_id?: number;
|
|
4595
4603
|
metamask_v4_compat?: boolean;
|
|
4596
4604
|
request_id?: string;
|
|
4605
|
+
source_fingerprint?: number;
|
|
4597
4606
|
};
|
|
4598
4607
|
|
|
4599
4608
|
// SetBusy
|
|
@@ -4766,6 +4775,19 @@ export type DeviceMiscUsbMscControl = {
|
|
|
4766
4775
|
enable: boolean;
|
|
4767
4776
|
};
|
|
4768
4777
|
|
|
4778
|
+
// DeviceFindMyTokenUpdate
|
|
4779
|
+
export type DeviceFindMyTokenUpdate = {
|
|
4780
|
+
token: string;
|
|
4781
|
+
};
|
|
4782
|
+
|
|
4783
|
+
// DeviceFindMyTokenStateGet
|
|
4784
|
+
export type DeviceFindMyTokenStateGet = {};
|
|
4785
|
+
|
|
4786
|
+
// DeviceFindMyTokenState
|
|
4787
|
+
export type DeviceFindMyTokenState = {
|
|
4788
|
+
burned: boolean;
|
|
4789
|
+
};
|
|
4790
|
+
|
|
4769
4791
|
export enum DeviceFactoryAck {
|
|
4770
4792
|
FACTORY_ACK_SUCCESS = 0,
|
|
4771
4793
|
FACTORY_ACK_FAIL = 1,
|
|
@@ -4837,6 +4859,12 @@ export enum DeviceFirmwareUpdateTaskStatus {
|
|
|
4837
4859
|
FW_MGMT_UPDATER_TASK_STATUS_FAILED_ENTRY_OUT_OF_BOUNDS = 10,
|
|
4838
4860
|
}
|
|
4839
4861
|
|
|
4862
|
+
export enum DeviceFirmwareUpdatePhase {
|
|
4863
|
+
FW_MGMT_UPDATER_PHASE_PREPARE = 0,
|
|
4864
|
+
FW_MGMT_UPDATER_PHASE_INSTALL = 1,
|
|
4865
|
+
FW_MGMT_UPDATER_PHASE_VERIFY = 2,
|
|
4866
|
+
}
|
|
4867
|
+
|
|
4840
4868
|
// DeviceFirmwareTarget
|
|
4841
4869
|
export type DeviceFirmwareTarget = {
|
|
4842
4870
|
target_id: DeviceFirmwareTargetType;
|
|
@@ -4849,12 +4877,22 @@ export type DeviceFirmwareUpdateStage = {
|
|
|
4849
4877
|
};
|
|
4850
4878
|
|
|
4851
4879
|
// DeviceFirmwareUpdateRequest
|
|
4852
|
-
export type DeviceFirmwareUpdateRequest = {
|
|
4880
|
+
export type DeviceFirmwareUpdateRequest = {
|
|
4881
|
+
reboot_after_update?: boolean;
|
|
4882
|
+
};
|
|
4883
|
+
|
|
4884
|
+
// DeviceFirmwareUpdatePhaseInfo
|
|
4885
|
+
export type DeviceFirmwareUpdatePhaseInfo = {
|
|
4886
|
+
phase: DeviceFirmwareUpdatePhase;
|
|
4887
|
+
progress_percent: number;
|
|
4888
|
+
};
|
|
4853
4889
|
|
|
4854
4890
|
// DeviceFirmwareUpdateRecord
|
|
4855
4891
|
export type DeviceFirmwareUpdateRecord = {
|
|
4856
4892
|
target_id: DeviceFirmwareTargetType;
|
|
4857
4893
|
status?: DeviceFirmwareUpdateTaskStatus;
|
|
4894
|
+
progress_percent?: number;
|
|
4895
|
+
phase_info?: DeviceFirmwareUpdatePhaseInfo;
|
|
4858
4896
|
payload_version?: number;
|
|
4859
4897
|
path?: string;
|
|
4860
4898
|
};
|
|
@@ -4862,6 +4900,8 @@ export type DeviceFirmwareUpdateRecord = {
|
|
|
4862
4900
|
// DeviceFirmwareUpdateRecordFields
|
|
4863
4901
|
export type DeviceFirmwareUpdateRecordFields = {
|
|
4864
4902
|
status?: boolean;
|
|
4903
|
+
progress_percent?: boolean;
|
|
4904
|
+
phase_info?: boolean;
|
|
4865
4905
|
payload_version?: boolean;
|
|
4866
4906
|
path?: boolean;
|
|
4867
4907
|
};
|
|
@@ -5220,6 +5260,7 @@ export type ViewTip = {
|
|
|
5220
5260
|
type: ViewTipType;
|
|
5221
5261
|
text?: string;
|
|
5222
5262
|
text_id?: number;
|
|
5263
|
+
text_arg?: string;
|
|
5223
5264
|
};
|
|
5224
5265
|
|
|
5225
5266
|
// ViewRawData
|
|
@@ -5247,6 +5288,7 @@ export type ViewSignPage = {
|
|
|
5247
5288
|
slide_to_confirm?: boolean;
|
|
5248
5289
|
layout?: ViewSignLayout;
|
|
5249
5290
|
title_id?: number;
|
|
5291
|
+
title_arg?: string;
|
|
5250
5292
|
};
|
|
5251
5293
|
|
|
5252
5294
|
// ViewVerifyPage
|
|
@@ -5888,6 +5930,9 @@ export type MessageType = {
|
|
|
5888
5930
|
DeviceCertificateSignature: DeviceCertificateSignature;
|
|
5889
5931
|
DeviceCertificateSign: DeviceCertificateSign;
|
|
5890
5932
|
DeviceMiscUsbMscControl: DeviceMiscUsbMscControl;
|
|
5933
|
+
DeviceFindMyTokenUpdate: DeviceFindMyTokenUpdate;
|
|
5934
|
+
DeviceFindMyTokenStateGet: DeviceFindMyTokenStateGet;
|
|
5935
|
+
DeviceFindMyTokenState: DeviceFindMyTokenState;
|
|
5891
5936
|
DeviceFactoryInfoManufactureTime: DeviceFactoryInfoManufactureTime;
|
|
5892
5937
|
DeviceFactoryInfo: DeviceFactoryInfo;
|
|
5893
5938
|
DeviceFactoryInfoSet: DeviceFactoryInfoSet;
|
|
@@ -5897,6 +5942,7 @@ export type MessageType = {
|
|
|
5897
5942
|
DeviceFirmwareTarget: DeviceFirmwareTarget;
|
|
5898
5943
|
DeviceFirmwareUpdateStage: DeviceFirmwareUpdateStage;
|
|
5899
5944
|
DeviceFirmwareUpdateRequest: DeviceFirmwareUpdateRequest;
|
|
5945
|
+
DeviceFirmwareUpdatePhaseInfo: DeviceFirmwareUpdatePhaseInfo;
|
|
5900
5946
|
DeviceFirmwareUpdateRecord: DeviceFirmwareUpdateRecord;
|
|
5901
5947
|
DeviceFirmwareUpdateRecordFields: DeviceFirmwareUpdateRecordFields;
|
|
5902
5948
|
DeviceFirmwareUpdateStatusGet: DeviceFirmwareUpdateStatusGet;
|