@onekeyfe/hd-transport 1.2.0-alpha.98 → 1.2.0
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-link-manager.test.js +126 -0
- package/__tests__/protocol-v2-usb-transport-base.test.js +6 -4
- package/__tests__/protocol-v2.test.js +309 -27
- package/dist/index.d.ts +131 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +255 -15
- package/dist/protocols/index.d.ts +12 -0
- package/dist/protocols/index.d.ts.map +1 -1
- package/dist/protocols/v2/errors.d.ts +8 -0
- package/dist/protocols/v2/errors.d.ts.map +1 -1
- package/dist/protocols/v2/link-manager.d.ts +2 -0
- package/dist/protocols/v2/link-manager.d.ts.map +1 -1
- package/dist/protocols/v2/session.d.ts +13 -1
- package/dist/protocols/v2/session.d.ts.map +1 -1
- package/dist/protocols/v2/usb-transport-base.d.ts +1 -0
- package/dist/protocols/v2/usb-transport-base.d.ts.map +1 -1
- package/dist/types/messages.d.ts +50 -7
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/types/transport.d.ts +4 -0
- package/dist/types/transport.d.ts.map +1 -1
- package/messages-protocol-v2.json +140 -13
- package/package.json +2 -2
- package/src/protocols/index.ts +91 -0
- package/src/protocols/v2/errors.ts +29 -0
- package/src/protocols/v2/link-manager.ts +57 -5
- package/src/protocols/v2/session.ts +133 -4
- package/src/protocols/v2/usb-transport-base.ts +13 -0
- package/src/types/messages.ts +61 -7
- package/src/types/transport.ts +11 -0
package/dist/types/messages.d.ts
CHANGED
|
@@ -1455,6 +1455,8 @@ export type EthereumSignTxOneKey = {
|
|
|
1455
1455
|
data_length?: number;
|
|
1456
1456
|
chain_id: number;
|
|
1457
1457
|
tx_type?: number;
|
|
1458
|
+
expected_address?: string;
|
|
1459
|
+
source_fingerprint?: number;
|
|
1458
1460
|
};
|
|
1459
1461
|
export type EthereumAccessListOneKey = {
|
|
1460
1462
|
address: string;
|
|
@@ -1472,6 +1474,8 @@ export type EthereumSignTxEIP1559OneKey = {
|
|
|
1472
1474
|
data_length: number;
|
|
1473
1475
|
chain_id: number;
|
|
1474
1476
|
access_list: EthereumAccessListOneKey[];
|
|
1477
|
+
expected_address?: string;
|
|
1478
|
+
source_fingerprint?: number;
|
|
1475
1479
|
};
|
|
1476
1480
|
export type EthereumAuthorizationSignature = {
|
|
1477
1481
|
y_parity: number;
|
|
@@ -1513,6 +1517,7 @@ export type EthereumSignMessageOneKey = {
|
|
|
1513
1517
|
address_n: number[];
|
|
1514
1518
|
message: string;
|
|
1515
1519
|
chain_id?: number;
|
|
1520
|
+
source_fingerprint?: number;
|
|
1516
1521
|
};
|
|
1517
1522
|
export type EthereumMessageSignatureOneKey = {
|
|
1518
1523
|
signature: string;
|
|
@@ -2845,6 +2850,7 @@ export type SolanaSignTx = {
|
|
|
2845
2850
|
address_n: number[];
|
|
2846
2851
|
raw_tx: string;
|
|
2847
2852
|
extra_info?: SolanaTxExtraInfo;
|
|
2853
|
+
source_fingerprint?: number;
|
|
2848
2854
|
};
|
|
2849
2855
|
export type SolanaSignedTx = {
|
|
2850
2856
|
signature?: string;
|
|
@@ -2862,10 +2868,12 @@ export type SolanaSignOffChainMessage = {
|
|
|
2862
2868
|
message_version?: SolanaOffChainMessageVersion;
|
|
2863
2869
|
message_format?: SolanaOffChainMessageFormat;
|
|
2864
2870
|
application_domain?: string;
|
|
2871
|
+
source_fingerprint?: number;
|
|
2865
2872
|
};
|
|
2866
2873
|
export type SolanaSignUnsafeMessage = {
|
|
2867
2874
|
address_n: number[];
|
|
2868
2875
|
message: string;
|
|
2876
|
+
source_fingerprint?: number;
|
|
2869
2877
|
};
|
|
2870
2878
|
export type SolanaMessageSignature = {
|
|
2871
2879
|
signature: string;
|
|
@@ -3445,6 +3453,7 @@ export type EthereumSignTypedDataQR = {
|
|
|
3445
3453
|
chain_id?: number;
|
|
3446
3454
|
metamask_v4_compat?: boolean;
|
|
3447
3455
|
request_id?: string;
|
|
3456
|
+
source_fingerprint?: number;
|
|
3448
3457
|
};
|
|
3449
3458
|
export type SetBusy = {
|
|
3450
3459
|
expiry_ms?: number;
|
|
@@ -3566,6 +3575,13 @@ export type DeviceCertificateSign = {
|
|
|
3566
3575
|
export type DeviceMiscUsbMscControl = {
|
|
3567
3576
|
enable: boolean;
|
|
3568
3577
|
};
|
|
3578
|
+
export type DeviceFindMyTokenUpdate = {
|
|
3579
|
+
token: string;
|
|
3580
|
+
};
|
|
3581
|
+
export type DeviceFindMyTokenStateGet = {};
|
|
3582
|
+
export type DeviceFindMyTokenState = {
|
|
3583
|
+
burned: boolean;
|
|
3584
|
+
};
|
|
3569
3585
|
export declare enum DeviceFactoryAck {
|
|
3570
3586
|
FACTORY_ACK_SUCCESS = 0,
|
|
3571
3587
|
FACTORY_ACK_FAIL = 1
|
|
@@ -3581,8 +3597,8 @@ export type DeviceFactoryInfoManufactureTime = {
|
|
|
3581
3597
|
export type DeviceFactoryInfo = {
|
|
3582
3598
|
version?: number;
|
|
3583
3599
|
serial_number?: string;
|
|
3584
|
-
burn_in_completed?: boolean;
|
|
3585
3600
|
factory_test_completed?: boolean;
|
|
3601
|
+
factory_burn_in_completed?: boolean;
|
|
3586
3602
|
manufacture_time?: DeviceFactoryInfoManufactureTime;
|
|
3587
3603
|
};
|
|
3588
3604
|
export type DeviceFactoryInfoSet = {
|
|
@@ -3622,21 +3638,37 @@ export declare enum DeviceFirmwareUpdateTaskStatus {
|
|
|
3622
3638
|
FW_MGMT_UPDATER_TASK_STATUS_FAILED_BUSY = 9,
|
|
3623
3639
|
FW_MGMT_UPDATER_TASK_STATUS_FAILED_ENTRY_OUT_OF_BOUNDS = 10
|
|
3624
3640
|
}
|
|
3641
|
+
export declare enum DeviceFirmwareUpdatePhase {
|
|
3642
|
+
FW_MGMT_UPDATER_PHASE_PREPARE = 0,
|
|
3643
|
+
FW_MGMT_UPDATER_PHASE_INSTALL = 1,
|
|
3644
|
+
FW_MGMT_UPDATER_PHASE_VERIFY = 2
|
|
3645
|
+
}
|
|
3625
3646
|
export type DeviceFirmwareTarget = {
|
|
3626
3647
|
target_id: DeviceFirmwareTargetType;
|
|
3627
3648
|
path: string;
|
|
3628
3649
|
};
|
|
3629
|
-
export type
|
|
3650
|
+
export type DeviceFirmwareUpdateStage = {
|
|
3630
3651
|
targets: DeviceFirmwareTarget[];
|
|
3631
3652
|
};
|
|
3653
|
+
export type DeviceFirmwareUpdateRequest = {
|
|
3654
|
+
reboot_after_update?: boolean;
|
|
3655
|
+
};
|
|
3656
|
+
export type DeviceFirmwareUpdatePhaseInfo = {
|
|
3657
|
+
phase: DeviceFirmwareUpdatePhase;
|
|
3658
|
+
progress_percent: number;
|
|
3659
|
+
};
|
|
3632
3660
|
export type DeviceFirmwareUpdateRecord = {
|
|
3633
3661
|
target_id: DeviceFirmwareTargetType;
|
|
3634
3662
|
status?: DeviceFirmwareUpdateTaskStatus;
|
|
3663
|
+
progress_percent?: number;
|
|
3664
|
+
phase_info?: DeviceFirmwareUpdatePhaseInfo;
|
|
3635
3665
|
payload_version?: number;
|
|
3636
3666
|
path?: string;
|
|
3637
3667
|
};
|
|
3638
3668
|
export type DeviceFirmwareUpdateRecordFields = {
|
|
3639
3669
|
status?: boolean;
|
|
3670
|
+
progress_percent?: boolean;
|
|
3671
|
+
phase_info?: boolean;
|
|
3640
3672
|
payload_version?: boolean;
|
|
3641
3673
|
path?: boolean;
|
|
3642
3674
|
};
|
|
@@ -3696,7 +3728,7 @@ export type DeviceSEInfo = {
|
|
|
3696
3728
|
};
|
|
3697
3729
|
export type DeviceInfoTargets = {
|
|
3698
3730
|
hw?: boolean;
|
|
3699
|
-
|
|
3731
|
+
main_mcu?: boolean;
|
|
3700
3732
|
coprocessor?: boolean;
|
|
3701
3733
|
se1?: boolean;
|
|
3702
3734
|
se2?: boolean;
|
|
@@ -3716,7 +3748,7 @@ export type DeviceInfoGet = {
|
|
|
3716
3748
|
export type ProtocolV2DeviceInfo = {
|
|
3717
3749
|
protocol_version: number;
|
|
3718
3750
|
hw?: DeviceHardwareInfo;
|
|
3719
|
-
|
|
3751
|
+
main_mcu?: DeviceMainMcuInfo;
|
|
3720
3752
|
coprocessor?: DeviceCoprocessorInfo;
|
|
3721
3753
|
se1?: DeviceSEInfo;
|
|
3722
3754
|
se2?: DeviceSEInfo;
|
|
@@ -3905,7 +3937,9 @@ export declare enum ViewTipType {
|
|
|
3905
3937
|
}
|
|
3906
3938
|
export type ViewTip = {
|
|
3907
3939
|
type: ViewTipType;
|
|
3908
|
-
text
|
|
3940
|
+
text?: string;
|
|
3941
|
+
text_id?: number;
|
|
3942
|
+
text_arg?: string;
|
|
3909
3943
|
};
|
|
3910
3944
|
export type ViewRawData = {
|
|
3911
3945
|
initial_data: string;
|
|
@@ -3920,21 +3954,25 @@ export declare enum ViewSignLayout {
|
|
|
3920
3954
|
LayoutEthApprove = 5
|
|
3921
3955
|
}
|
|
3922
3956
|
export type ViewSignPage = {
|
|
3923
|
-
title
|
|
3957
|
+
title?: string;
|
|
3924
3958
|
amount?: UintType;
|
|
3925
3959
|
general: ViewDetail[];
|
|
3926
3960
|
tip?: ViewTip;
|
|
3927
3961
|
raw_data?: ViewRawData;
|
|
3928
3962
|
slide_to_confirm?: boolean;
|
|
3929
3963
|
layout?: ViewSignLayout;
|
|
3964
|
+
title_id?: number;
|
|
3965
|
+
title_arg?: string;
|
|
3930
3966
|
};
|
|
3931
3967
|
export type ViewVerifyPage = {
|
|
3932
|
-
title
|
|
3968
|
+
title?: string;
|
|
3933
3969
|
address: string;
|
|
3934
3970
|
path: string;
|
|
3935
3971
|
network?: string;
|
|
3936
3972
|
derive_type?: string;
|
|
3937
3973
|
value_key?: number;
|
|
3974
|
+
title_id?: number;
|
|
3975
|
+
chain_id?: number;
|
|
3938
3976
|
};
|
|
3939
3977
|
export declare enum ProtocolV2FailureType {
|
|
3940
3978
|
Failure_InvalidMessage = 1,
|
|
@@ -4560,6 +4598,9 @@ export type MessageType = {
|
|
|
4560
4598
|
DeviceCertificateSignature: DeviceCertificateSignature;
|
|
4561
4599
|
DeviceCertificateSign: DeviceCertificateSign;
|
|
4562
4600
|
DeviceMiscUsbMscControl: DeviceMiscUsbMscControl;
|
|
4601
|
+
DeviceFindMyTokenUpdate: DeviceFindMyTokenUpdate;
|
|
4602
|
+
DeviceFindMyTokenStateGet: DeviceFindMyTokenStateGet;
|
|
4603
|
+
DeviceFindMyTokenState: DeviceFindMyTokenState;
|
|
4563
4604
|
DeviceFactoryInfoManufactureTime: DeviceFactoryInfoManufactureTime;
|
|
4564
4605
|
DeviceFactoryInfo: DeviceFactoryInfo;
|
|
4565
4606
|
DeviceFactoryInfoSet: DeviceFactoryInfoSet;
|
|
@@ -4567,7 +4608,9 @@ export type MessageType = {
|
|
|
4567
4608
|
DeviceFactoryPermanentLock: DeviceFactoryPermanentLock;
|
|
4568
4609
|
DeviceFactoryTest: DeviceFactoryTest;
|
|
4569
4610
|
DeviceFirmwareTarget: DeviceFirmwareTarget;
|
|
4611
|
+
DeviceFirmwareUpdateStage: DeviceFirmwareUpdateStage;
|
|
4570
4612
|
DeviceFirmwareUpdateRequest: DeviceFirmwareUpdateRequest;
|
|
4613
|
+
DeviceFirmwareUpdatePhaseInfo: DeviceFirmwareUpdatePhaseInfo;
|
|
4571
4614
|
DeviceFirmwareUpdateRecord: DeviceFirmwareUpdateRecord;
|
|
4572
4615
|
DeviceFirmwareUpdateRecordFields: DeviceFirmwareUpdateRecordFields;
|
|
4573
4616
|
DeviceFirmwareUpdateStatusGet: DeviceFirmwareUpdateStatusGet;
|