@onekeyfe/hd-transport 1.2.0-alpha.34 → 1.2.0-alpha.36
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__/messages.test.js +49 -29
- package/__tests__/protocol-v2.test.js +14 -14
- package/__tests__/transport-log.test.js +79 -0
- package/dist/index.d.ts +228 -242
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +159 -74
- package/dist/types/messages.d.ts +161 -177
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/utils/transportLog.d.ts +9 -0
- package/dist/utils/transportLog.d.ts.map +1 -0
- package/messages-protocol-v2.json +408 -485
- package/package.json +2 -2
- package/scripts/protobuf-patches/index.js +1 -0
- package/src/index.ts +1 -0
- package/src/types/messages.ts +203 -225
- package/src/utils/transportLog.ts +102 -0
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.36",
|
|
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": "94f0fec6ea1dfd4ffea2dae8ea2b0b4a2a6cf2be"
|
|
32
32
|
}
|
|
@@ -11,6 +11,7 @@ const RULE_PATCH = {
|
|
|
11
11
|
'TxRequest.request_type': 'required',
|
|
12
12
|
'TxRequest.details': 'required',
|
|
13
13
|
'TxAckPaymentRequest.memos': 'optional', // protobuf repeated bytes are always optional (fallback to [])
|
|
14
|
+
'DeviceSessionGet.seed_domains': 'optional', // omitted means all supported seed domains
|
|
14
15
|
'CardanoPoolOwnerType.staking_key_path': 'optional',
|
|
15
16
|
'CardanoPoolOwner.staking_key_path': 'optional',
|
|
16
17
|
'CardanoTxCertificateType.path': 'optional',
|
package/src/index.ts
CHANGED
package/src/types/messages.ts
CHANGED
|
@@ -4596,21 +4596,6 @@ export type EthereumSignTypedDataQR = {
|
|
|
4596
4596
|
request_id?: string;
|
|
4597
4597
|
};
|
|
4598
4598
|
|
|
4599
|
-
// InternalMyAddressRequest
|
|
4600
|
-
export type InternalMyAddressRequest = {
|
|
4601
|
-
coin_type: number;
|
|
4602
|
-
chain_id: number;
|
|
4603
|
-
account_index: number;
|
|
4604
|
-
derive_type: number;
|
|
4605
|
-
};
|
|
4606
|
-
|
|
4607
|
-
// StartSession
|
|
4608
|
-
export type StartSession = {
|
|
4609
|
-
session_id?: string;
|
|
4610
|
-
_skip_passphrase?: boolean;
|
|
4611
|
-
derive_cardano?: boolean;
|
|
4612
|
-
};
|
|
4613
|
-
|
|
4614
4599
|
// SetBusy
|
|
4615
4600
|
export type SetBusy = {
|
|
4616
4601
|
expiry_ms?: number;
|
|
@@ -4639,28 +4624,6 @@ export type WriteSEPrivateKey = {
|
|
|
4639
4624
|
private_key: string;
|
|
4640
4625
|
};
|
|
4641
4626
|
|
|
4642
|
-
export enum WallpaperTarget {
|
|
4643
|
-
Home = 0,
|
|
4644
|
-
Lock = 1,
|
|
4645
|
-
}
|
|
4646
|
-
|
|
4647
|
-
// SetWallpaper
|
|
4648
|
-
export type SetWallpaper = {
|
|
4649
|
-
target: WallpaperTarget;
|
|
4650
|
-
path: string;
|
|
4651
|
-
};
|
|
4652
|
-
|
|
4653
|
-
// GetWallpaper
|
|
4654
|
-
export type GetWallpaper = {
|
|
4655
|
-
target: WallpaperTarget;
|
|
4656
|
-
};
|
|
4657
|
-
|
|
4658
|
-
// Wallpaper
|
|
4659
|
-
export type Wallpaper = {
|
|
4660
|
-
target: WallpaperTarget;
|
|
4661
|
-
path: string;
|
|
4662
|
-
};
|
|
4663
|
-
|
|
4664
4627
|
// UnlockPath
|
|
4665
4628
|
export type UnlockPath = {
|
|
4666
4629
|
address_n: number[];
|
|
@@ -4697,70 +4660,6 @@ export type UiAnimationRequest = {
|
|
|
4697
4660
|
type?: UiAnimationType;
|
|
4698
4661
|
};
|
|
4699
4662
|
|
|
4700
|
-
// ViewAmount
|
|
4701
|
-
export type ViewAmount = {
|
|
4702
|
-
is_unlimited: boolean;
|
|
4703
|
-
num: string;
|
|
4704
|
-
};
|
|
4705
|
-
|
|
4706
|
-
// ViewDetail
|
|
4707
|
-
export type ViewDetail = {
|
|
4708
|
-
key: number;
|
|
4709
|
-
value: string;
|
|
4710
|
-
is_overview: boolean;
|
|
4711
|
-
has_icon: boolean;
|
|
4712
|
-
};
|
|
4713
|
-
|
|
4714
|
-
export enum ViewTipType {
|
|
4715
|
-
Default = 0,
|
|
4716
|
-
Highlight = 1,
|
|
4717
|
-
Recommend = 2,
|
|
4718
|
-
Warning = 3,
|
|
4719
|
-
Danger = 4,
|
|
4720
|
-
}
|
|
4721
|
-
|
|
4722
|
-
// ViewTip
|
|
4723
|
-
export type ViewTip = {
|
|
4724
|
-
type: ViewTipType;
|
|
4725
|
-
text: string;
|
|
4726
|
-
};
|
|
4727
|
-
|
|
4728
|
-
// ViewRawData
|
|
4729
|
-
export type ViewRawData = {
|
|
4730
|
-
initial_data: string;
|
|
4731
|
-
placeholder: number;
|
|
4732
|
-
};
|
|
4733
|
-
|
|
4734
|
-
export enum ViewSignLayout {
|
|
4735
|
-
LayoutDefault = 0,
|
|
4736
|
-
LayoutSafeTxCreate = 1,
|
|
4737
|
-
LayoutFinalConfirm = 2,
|
|
4738
|
-
Layout7702 = 3,
|
|
4739
|
-
LayoutFlat = 4,
|
|
4740
|
-
LayoutEthApprove = 5,
|
|
4741
|
-
}
|
|
4742
|
-
|
|
4743
|
-
// ViewSignPage
|
|
4744
|
-
export type ViewSignPage = {
|
|
4745
|
-
title: string;
|
|
4746
|
-
amount?: UintType;
|
|
4747
|
-
general: ViewDetail[];
|
|
4748
|
-
tip?: ViewTip;
|
|
4749
|
-
raw_data?: ViewRawData;
|
|
4750
|
-
slide_to_confirm?: boolean;
|
|
4751
|
-
layout?: ViewSignLayout;
|
|
4752
|
-
};
|
|
4753
|
-
|
|
4754
|
-
// ViewVerifyPage
|
|
4755
|
-
export type ViewVerifyPage = {
|
|
4756
|
-
title: string;
|
|
4757
|
-
address: string;
|
|
4758
|
-
path: string;
|
|
4759
|
-
network?: string;
|
|
4760
|
-
derive_type?: string;
|
|
4761
|
-
value_key?: number;
|
|
4762
|
-
};
|
|
4763
|
-
|
|
4764
4663
|
// ProtocolInfoRequest
|
|
4765
4664
|
export type ProtocolInfoRequest = {
|
|
4766
4665
|
eventless_wallet_session?: boolean;
|
|
@@ -4769,8 +4668,8 @@ export type ProtocolInfoRequest = {
|
|
|
4769
4668
|
// ProtocolInfo
|
|
4770
4669
|
export type ProtocolInfo = {
|
|
4771
4670
|
version: number;
|
|
4671
|
+
build_fingerprint: string;
|
|
4772
4672
|
supported_messages: number[];
|
|
4773
|
-
protobuf_definition?: string;
|
|
4774
4673
|
};
|
|
4775
4674
|
|
|
4776
4675
|
export enum DeviceErrorCode {
|
|
@@ -4862,6 +4761,54 @@ export type DeviceCertificateSign = {
|
|
|
4862
4761
|
data: string;
|
|
4863
4762
|
};
|
|
4864
4763
|
|
|
4764
|
+
// DeviceMiscUsbMscControl
|
|
4765
|
+
export type DeviceMiscUsbMscControl = {
|
|
4766
|
+
enable: boolean;
|
|
4767
|
+
};
|
|
4768
|
+
|
|
4769
|
+
export enum DeviceFactoryAck {
|
|
4770
|
+
FACTORY_ACK_SUCCESS = 0,
|
|
4771
|
+
FACTORY_ACK_FAIL = 1,
|
|
4772
|
+
}
|
|
4773
|
+
|
|
4774
|
+
// DeviceFactoryInfoManufactureTime
|
|
4775
|
+
export type DeviceFactoryInfoManufactureTime = {
|
|
4776
|
+
year: number;
|
|
4777
|
+
month: number;
|
|
4778
|
+
day: number;
|
|
4779
|
+
hour: number;
|
|
4780
|
+
minute: number;
|
|
4781
|
+
second: number;
|
|
4782
|
+
};
|
|
4783
|
+
|
|
4784
|
+
// DeviceFactoryInfo
|
|
4785
|
+
export type DeviceFactoryInfo = {
|
|
4786
|
+
version?: number;
|
|
4787
|
+
serial_number?: string;
|
|
4788
|
+
burn_in_completed?: boolean;
|
|
4789
|
+
factory_test_completed?: boolean;
|
|
4790
|
+
manufacture_time?: DeviceFactoryInfoManufactureTime;
|
|
4791
|
+
};
|
|
4792
|
+
|
|
4793
|
+
// DeviceFactoryInfoSet
|
|
4794
|
+
export type DeviceFactoryInfoSet = {
|
|
4795
|
+
info: DeviceFactoryInfo;
|
|
4796
|
+
};
|
|
4797
|
+
|
|
4798
|
+
// DeviceFactoryInfoGet
|
|
4799
|
+
export type DeviceFactoryInfoGet = {};
|
|
4800
|
+
|
|
4801
|
+
// DeviceFactoryPermanentLock
|
|
4802
|
+
export type DeviceFactoryPermanentLock = {
|
|
4803
|
+
check_a: string;
|
|
4804
|
+
check_b: string;
|
|
4805
|
+
};
|
|
4806
|
+
|
|
4807
|
+
// DeviceFactoryTest
|
|
4808
|
+
export type DeviceFactoryTest = {
|
|
4809
|
+
burn_in_test: boolean;
|
|
4810
|
+
};
|
|
4811
|
+
|
|
4865
4812
|
export enum DeviceFirmwareTargetType {
|
|
4866
4813
|
FW_MGMT_TARGET_INVALID = 0,
|
|
4867
4814
|
FW_MGMT_TARGET_CRATE = 1,
|
|
@@ -4926,49 +4873,6 @@ export type DeviceFirmwareUpdateStatus = {
|
|
|
4926
4873
|
records: DeviceFirmwareUpdateRecord[];
|
|
4927
4874
|
};
|
|
4928
4875
|
|
|
4929
|
-
export enum DeviceFactoryAck {
|
|
4930
|
-
FACTORY_ACK_SUCCESS = 0,
|
|
4931
|
-
FACTORY_ACK_FAIL = 1,
|
|
4932
|
-
}
|
|
4933
|
-
|
|
4934
|
-
// DeviceFactoryInfoManufactureTime
|
|
4935
|
-
export type DeviceFactoryInfoManufactureTime = {
|
|
4936
|
-
year: number;
|
|
4937
|
-
month: number;
|
|
4938
|
-
day: number;
|
|
4939
|
-
hour: number;
|
|
4940
|
-
minute: number;
|
|
4941
|
-
second: number;
|
|
4942
|
-
};
|
|
4943
|
-
|
|
4944
|
-
// DeviceFactoryInfo
|
|
4945
|
-
export type DeviceFactoryInfo = {
|
|
4946
|
-
version?: number;
|
|
4947
|
-
serial_number?: string;
|
|
4948
|
-
burn_in_completed?: boolean;
|
|
4949
|
-
factory_test_completed?: boolean;
|
|
4950
|
-
manufacture_time?: DeviceFactoryInfoManufactureTime;
|
|
4951
|
-
};
|
|
4952
|
-
|
|
4953
|
-
// DeviceFactoryInfoSet
|
|
4954
|
-
export type DeviceFactoryInfoSet = {
|
|
4955
|
-
info: DeviceFactoryInfo;
|
|
4956
|
-
};
|
|
4957
|
-
|
|
4958
|
-
// DeviceFactoryInfoGet
|
|
4959
|
-
export type DeviceFactoryInfoGet = {};
|
|
4960
|
-
|
|
4961
|
-
// DeviceFactoryPermanentLock
|
|
4962
|
-
export type DeviceFactoryPermanentLock = {
|
|
4963
|
-
check_a: string;
|
|
4964
|
-
check_b: string;
|
|
4965
|
-
};
|
|
4966
|
-
|
|
4967
|
-
// DeviceFactoryTest
|
|
4968
|
-
export type DeviceFactoryTest = {
|
|
4969
|
-
burn_in_test: boolean;
|
|
4970
|
-
};
|
|
4971
|
-
|
|
4972
4876
|
export enum DeviceType {
|
|
4973
4877
|
CLASSIC1 = 0,
|
|
4974
4878
|
CLASSIC1S = 1,
|
|
@@ -5039,7 +4943,6 @@ export type DeviceInfoTargets = {
|
|
|
5039
4943
|
se2?: boolean;
|
|
5040
4944
|
se3?: boolean;
|
|
5041
4945
|
se4?: boolean;
|
|
5042
|
-
status?: boolean;
|
|
5043
4946
|
};
|
|
5044
4947
|
|
|
5045
4948
|
// DeviceInfoTypes
|
|
@@ -5066,7 +4969,6 @@ export type ProtocolV2DeviceInfo = {
|
|
|
5066
4969
|
se2?: DeviceSEInfo;
|
|
5067
4970
|
se3?: DeviceSEInfo;
|
|
5068
4971
|
se4?: DeviceSEInfo;
|
|
5069
|
-
status?: DeviceStatus;
|
|
5070
4972
|
};
|
|
5071
4973
|
|
|
5072
4974
|
export enum DeviceSessionErrorCode {
|
|
@@ -5078,9 +4980,16 @@ export enum DeviceSessionErrorCode {
|
|
|
5078
4980
|
DeviceSessionError_Busy = 5,
|
|
5079
4981
|
}
|
|
5080
4982
|
|
|
4983
|
+
export enum DeviceSessionSeedDomain {
|
|
4984
|
+
SeedDomain_Standard = 1,
|
|
4985
|
+
SeedDomain_Cardano = 2,
|
|
4986
|
+
}
|
|
4987
|
+
|
|
5081
4988
|
// DeviceSessionGet
|
|
5082
4989
|
export type DeviceSessionGet = {
|
|
5083
4990
|
session_id?: string;
|
|
4991
|
+
btc_test_address?: string;
|
|
4992
|
+
seed_domains?: DeviceSessionSeedDomain[];
|
|
5084
4993
|
};
|
|
5085
4994
|
|
|
5086
4995
|
// DeviceSession
|
|
@@ -5103,7 +5012,7 @@ export type DeviceSessionAskPin = {
|
|
|
5103
5012
|
// DeviceSessionAskPassphrase
|
|
5104
5013
|
export type DeviceSessionAskPassphrase = {
|
|
5105
5014
|
passphrase?: string;
|
|
5106
|
-
on_device
|
|
5015
|
+
on_device: boolean;
|
|
5107
5016
|
};
|
|
5108
5017
|
|
|
5109
5018
|
export enum DeviceSessionAskPin_FailureSubCodes {
|
|
@@ -5124,63 +5033,6 @@ export type DeviceStatus = {
|
|
|
5124
5033
|
// DeviceStatusGet
|
|
5125
5034
|
export type DeviceStatusGet = {};
|
|
5126
5035
|
|
|
5127
|
-
export enum DevOnboardingStep {
|
|
5128
|
-
DEV_ONBOARDING_STEP_UNKNOWN = 0,
|
|
5129
|
-
DEV_ONBOARDING_STEP_CHECKING = 1,
|
|
5130
|
-
DEV_ONBOARDING_STEP_PERSONALIZATION = 2,
|
|
5131
|
-
DEV_ONBOARDING_STEP_PIN = 3,
|
|
5132
|
-
DEV_ONBOARDING_STEP_SETUP = 4,
|
|
5133
|
-
DEV_ONBOARDING_STEP_DONE = 5,
|
|
5134
|
-
}
|
|
5135
|
-
|
|
5136
|
-
export enum DevOnboardingPhase {
|
|
5137
|
-
DEV_ONBOARDING_PHASE_UNKNOWN = 0,
|
|
5138
|
-
DEV_ONBOARDING_PHASE_SAFETY_CHECK = 1,
|
|
5139
|
-
DEV_ONBOARDING_PHASE_PIN_SETUP = 2,
|
|
5140
|
-
DEV_ONBOARDING_PHASE_FINGERPRINT_SETUP = 3,
|
|
5141
|
-
DEV_ONBOARDING_PHASE_SETUP_CHOICE = 4,
|
|
5142
|
-
DEV_ONBOARDING_PHASE_WALLET_CREATE_START = 5,
|
|
5143
|
-
DEV_ONBOARDING_PHASE_RECOVERY_PHRASE_VIEW = 6,
|
|
5144
|
-
DEV_ONBOARDING_PHASE_RECOVERY_PHRASE_CONFIRM = 7,
|
|
5145
|
-
DEV_ONBOARDING_PHASE_RESTORE_METHOD_CHOICE = 8,
|
|
5146
|
-
DEV_ONBOARDING_PHASE_RECOVERY_PHRASE_RESTORE = 9,
|
|
5147
|
-
DEV_ONBOARDING_PHASE_SEEDCARD_RESTORE = 10,
|
|
5148
|
-
DEV_ONBOARDING_PHASE_WALLET_READY = 11,
|
|
5149
|
-
DEV_ONBOARDING_PHASE_SEEDCARD_BACKUP_PROMPT = 12,
|
|
5150
|
-
DEV_ONBOARDING_PHASE_SEEDCARD_BACKUP = 13,
|
|
5151
|
-
}
|
|
5152
|
-
|
|
5153
|
-
export enum DevOnboardingSetupKind {
|
|
5154
|
-
DEV_ONBOARDING_SETUP_KIND_UNKNOWN = 0,
|
|
5155
|
-
DEV_ONBOARDING_SETUP_KIND_CHOICE = 1,
|
|
5156
|
-
DEV_ONBOARDING_SETUP_KIND_CREATE = 2,
|
|
5157
|
-
DEV_ONBOARDING_SETUP_KIND_RESTORE = 3,
|
|
5158
|
-
}
|
|
5159
|
-
|
|
5160
|
-
export enum DevOnboardingSetupMethod {
|
|
5161
|
-
DEV_ONBOARDING_SETUP_METHOD_UNKNOWN = 0,
|
|
5162
|
-
DEV_ONBOARDING_SETUP_METHOD_RECOVERY_PHRASE = 1,
|
|
5163
|
-
DEV_ONBOARDING_SETUP_METHOD_SEEDCARD = 2,
|
|
5164
|
-
}
|
|
5165
|
-
|
|
5166
|
-
// DevOnboardingSetupStatus
|
|
5167
|
-
export type DevOnboardingSetupStatus = {
|
|
5168
|
-
kind?: DevOnboardingSetupKind;
|
|
5169
|
-
method?: DevOnboardingSetupMethod;
|
|
5170
|
-
};
|
|
5171
|
-
|
|
5172
|
-
// DevGetOnboardingStatus
|
|
5173
|
-
export type DevGetOnboardingStatus = {};
|
|
5174
|
-
|
|
5175
|
-
// DevOnboardingStatus
|
|
5176
|
-
export type DevOnboardingStatus = {
|
|
5177
|
-
step?: DevOnboardingStep;
|
|
5178
|
-
phase?: DevOnboardingPhase;
|
|
5179
|
-
setup?: DevOnboardingSetupStatus;
|
|
5180
|
-
pin_set?: boolean;
|
|
5181
|
-
wallet_initialized?: boolean;
|
|
5182
|
-
};
|
|
5183
|
-
|
|
5184
5036
|
// FilesystemPermissionFix
|
|
5185
5037
|
export type FilesystemPermissionFix = {};
|
|
5186
5038
|
|
|
@@ -5265,9 +5117,138 @@ export type FilesystemFormat = {
|
|
|
5265
5117
|
user: boolean;
|
|
5266
5118
|
};
|
|
5267
5119
|
|
|
5120
|
+
// InternalMyAddressRequest
|
|
5121
|
+
export type InternalMyAddressRequest = {
|
|
5122
|
+
coin_type: number;
|
|
5123
|
+
chain_id: number;
|
|
5124
|
+
account_index: number;
|
|
5125
|
+
derive_type: number;
|
|
5126
|
+
};
|
|
5127
|
+
|
|
5128
|
+
export enum OnboardingStep {
|
|
5129
|
+
ONBOARDING_STEP_UNKNOWN = 0,
|
|
5130
|
+
ONBOARDING_STEP_CHECKING = 1,
|
|
5131
|
+
ONBOARDING_STEP_PERSONALIZATION = 2,
|
|
5132
|
+
ONBOARDING_STEP_PIN = 3,
|
|
5133
|
+
ONBOARDING_STEP_SETUP = 4,
|
|
5134
|
+
ONBOARDING_STEP_DONE = 5,
|
|
5135
|
+
}
|
|
5136
|
+
|
|
5137
|
+
export enum OnboardingPhase {
|
|
5138
|
+
ONBOARDING_PHASE_UNKNOWN = 0,
|
|
5139
|
+
ONBOARDING_PHASE_SAFETY_CHECK = 1,
|
|
5140
|
+
ONBOARDING_PHASE_PIN_SETUP = 2,
|
|
5141
|
+
ONBOARDING_PHASE_FINGERPRINT_SETUP = 3,
|
|
5142
|
+
ONBOARDING_PHASE_SETUP_CHOICE = 4,
|
|
5143
|
+
ONBOARDING_PHASE_WALLET_CREATE_START = 5,
|
|
5144
|
+
ONBOARDING_PHASE_RECOVERY_PHRASE_VIEW = 6,
|
|
5145
|
+
ONBOARDING_PHASE_RECOVERY_PHRASE_CONFIRM = 7,
|
|
5146
|
+
ONBOARDING_PHASE_RESTORE_METHOD_CHOICE = 8,
|
|
5147
|
+
ONBOARDING_PHASE_RECOVERY_PHRASE_RESTORE = 9,
|
|
5148
|
+
ONBOARDING_PHASE_SEEDCARD_RESTORE = 10,
|
|
5149
|
+
ONBOARDING_PHASE_WALLET_READY = 11,
|
|
5150
|
+
ONBOARDING_PHASE_SEEDCARD_BACKUP_PROMPT = 12,
|
|
5151
|
+
ONBOARDING_PHASE_SEEDCARD_BACKUP = 13,
|
|
5152
|
+
}
|
|
5153
|
+
|
|
5154
|
+
export enum OnboardingSetupKind {
|
|
5155
|
+
ONBOARDING_SETUP_KIND_UNKNOWN = 0,
|
|
5156
|
+
ONBOARDING_SETUP_KIND_CHOICE = 1,
|
|
5157
|
+
ONBOARDING_SETUP_KIND_CREATE = 2,
|
|
5158
|
+
ONBOARDING_SETUP_KIND_RESTORE = 3,
|
|
5159
|
+
}
|
|
5160
|
+
|
|
5161
|
+
export enum OnboardingSetupMethod {
|
|
5162
|
+
ONBOARDING_SETUP_METHOD_UNKNOWN = 0,
|
|
5163
|
+
ONBOARDING_SETUP_METHOD_RECOVERY_PHRASE = 1,
|
|
5164
|
+
ONBOARDING_SETUP_METHOD_SEEDCARD = 2,
|
|
5165
|
+
}
|
|
5166
|
+
|
|
5167
|
+
// OnboardingSetupStatus
|
|
5168
|
+
export type OnboardingSetupStatus = {
|
|
5169
|
+
kind?: OnboardingSetupKind;
|
|
5170
|
+
method?: OnboardingSetupMethod;
|
|
5171
|
+
};
|
|
5172
|
+
|
|
5173
|
+
// OnboardingStatusGet
|
|
5174
|
+
export type OnboardingStatusGet = {};
|
|
5175
|
+
|
|
5176
|
+
// OnboardingStatus
|
|
5177
|
+
export type OnboardingStatus = {
|
|
5178
|
+
step?: OnboardingStep;
|
|
5179
|
+
phase?: OnboardingPhase;
|
|
5180
|
+
setup?: OnboardingSetupStatus;
|
|
5181
|
+
pin_set?: boolean;
|
|
5182
|
+
wallet_initialized?: boolean;
|
|
5183
|
+
};
|
|
5184
|
+
|
|
5268
5185
|
// PortfolioUpdate
|
|
5269
5186
|
export type PortfolioUpdate = {};
|
|
5270
5187
|
|
|
5188
|
+
// ViewAmount
|
|
5189
|
+
export type ViewAmount = {
|
|
5190
|
+
is_unlimited: boolean;
|
|
5191
|
+
num: string;
|
|
5192
|
+
};
|
|
5193
|
+
|
|
5194
|
+
// ViewDetail
|
|
5195
|
+
export type ViewDetail = {
|
|
5196
|
+
key: number;
|
|
5197
|
+
value: string;
|
|
5198
|
+
is_overview: boolean;
|
|
5199
|
+
has_icon: boolean;
|
|
5200
|
+
};
|
|
5201
|
+
|
|
5202
|
+
export enum ViewTipType {
|
|
5203
|
+
Default = 0,
|
|
5204
|
+
Highlight = 1,
|
|
5205
|
+
Recommend = 2,
|
|
5206
|
+
Warning = 3,
|
|
5207
|
+
Danger = 4,
|
|
5208
|
+
}
|
|
5209
|
+
|
|
5210
|
+
// ViewTip
|
|
5211
|
+
export type ViewTip = {
|
|
5212
|
+
type: ViewTipType;
|
|
5213
|
+
text: string;
|
|
5214
|
+
};
|
|
5215
|
+
|
|
5216
|
+
// ViewRawData
|
|
5217
|
+
export type ViewRawData = {
|
|
5218
|
+
initial_data: string;
|
|
5219
|
+
placeholder: number;
|
|
5220
|
+
};
|
|
5221
|
+
|
|
5222
|
+
export enum ViewSignLayout {
|
|
5223
|
+
LayoutDefault = 0,
|
|
5224
|
+
LayoutSafeTxCreate = 1,
|
|
5225
|
+
LayoutFinalConfirm = 2,
|
|
5226
|
+
Layout7702 = 3,
|
|
5227
|
+
LayoutFlat = 4,
|
|
5228
|
+
LayoutEthApprove = 5,
|
|
5229
|
+
}
|
|
5230
|
+
|
|
5231
|
+
// ViewSignPage
|
|
5232
|
+
export type ViewSignPage = {
|
|
5233
|
+
title: string;
|
|
5234
|
+
amount?: UintType;
|
|
5235
|
+
general: ViewDetail[];
|
|
5236
|
+
tip?: ViewTip;
|
|
5237
|
+
raw_data?: ViewRawData;
|
|
5238
|
+
slide_to_confirm?: boolean;
|
|
5239
|
+
layout?: ViewSignLayout;
|
|
5240
|
+
};
|
|
5241
|
+
|
|
5242
|
+
// ViewVerifyPage
|
|
5243
|
+
export type ViewVerifyPage = {
|
|
5244
|
+
title: string;
|
|
5245
|
+
address: string;
|
|
5246
|
+
path: string;
|
|
5247
|
+
network?: string;
|
|
5248
|
+
derive_type?: string;
|
|
5249
|
+
value_key?: number;
|
|
5250
|
+
};
|
|
5251
|
+
|
|
5271
5252
|
export enum ProtocolV2FailureType {
|
|
5272
5253
|
Failure_InvalidMessage = 1,
|
|
5273
5254
|
Failure_UndefinedError = 2,
|
|
@@ -5873,26 +5854,15 @@ export type MessageType = {
|
|
|
5873
5854
|
PaymentRequestMemo: PaymentRequestMemo;
|
|
5874
5855
|
TxAckPaymentRequest: TxAckPaymentRequest;
|
|
5875
5856
|
EthereumSignTypedDataQR: EthereumSignTypedDataQR;
|
|
5876
|
-
InternalMyAddressRequest: InternalMyAddressRequest;
|
|
5877
|
-
StartSession: StartSession;
|
|
5878
5857
|
SetBusy: SetBusy;
|
|
5879
5858
|
GetFirmwareHash: GetFirmwareHash;
|
|
5880
5859
|
FirmwareHash: FirmwareHash;
|
|
5881
5860
|
GetNonce: GetNonce;
|
|
5882
5861
|
Nonce: Nonce;
|
|
5883
5862
|
WriteSEPrivateKey: WriteSEPrivateKey;
|
|
5884
|
-
SetWallpaper: SetWallpaper;
|
|
5885
|
-
GetWallpaper: GetWallpaper;
|
|
5886
|
-
Wallpaper: Wallpaper;
|
|
5887
5863
|
UnlockPath: UnlockPath;
|
|
5888
5864
|
UnlockedPathRequest: UnlockedPathRequest;
|
|
5889
5865
|
UiAnimationRequest: UiAnimationRequest;
|
|
5890
|
-
ViewAmount: ViewAmount;
|
|
5891
|
-
ViewDetail: ViewDetail;
|
|
5892
|
-
ViewTip: ViewTip;
|
|
5893
|
-
ViewRawData: ViewRawData;
|
|
5894
|
-
ViewSignPage: ViewSignPage;
|
|
5895
|
-
ViewVerifyPage: ViewVerifyPage;
|
|
5896
5866
|
ProtocolInfoRequest: ProtocolInfoRequest;
|
|
5897
5867
|
ProtocolInfo: ProtocolInfo;
|
|
5898
5868
|
DeviceReboot: DeviceReboot;
|
|
@@ -5905,18 +5875,19 @@ export type MessageType = {
|
|
|
5905
5875
|
DeviceCertificateRead: DeviceCertificateRead;
|
|
5906
5876
|
DeviceCertificateSignature: DeviceCertificateSignature;
|
|
5907
5877
|
DeviceCertificateSign: DeviceCertificateSign;
|
|
5908
|
-
|
|
5909
|
-
DeviceFirmwareUpdateRequest: DeviceFirmwareUpdateRequest;
|
|
5910
|
-
DeviceFirmwareUpdateRecord: DeviceFirmwareUpdateRecord;
|
|
5911
|
-
DeviceFirmwareUpdateRecordFields: DeviceFirmwareUpdateRecordFields;
|
|
5912
|
-
DeviceFirmwareUpdateStatusGet: DeviceFirmwareUpdateStatusGet;
|
|
5913
|
-
DeviceFirmwareUpdateStatus: DeviceFirmwareUpdateStatus;
|
|
5878
|
+
DeviceMiscUsbMscControl: DeviceMiscUsbMscControl;
|
|
5914
5879
|
DeviceFactoryInfoManufactureTime: DeviceFactoryInfoManufactureTime;
|
|
5915
5880
|
DeviceFactoryInfo: DeviceFactoryInfo;
|
|
5916
5881
|
DeviceFactoryInfoSet: DeviceFactoryInfoSet;
|
|
5917
5882
|
DeviceFactoryInfoGet: DeviceFactoryInfoGet;
|
|
5918
5883
|
DeviceFactoryPermanentLock: DeviceFactoryPermanentLock;
|
|
5919
5884
|
DeviceFactoryTest: DeviceFactoryTest;
|
|
5885
|
+
DeviceFirmwareTarget: DeviceFirmwareTarget;
|
|
5886
|
+
DeviceFirmwareUpdateRequest: DeviceFirmwareUpdateRequest;
|
|
5887
|
+
DeviceFirmwareUpdateRecord: DeviceFirmwareUpdateRecord;
|
|
5888
|
+
DeviceFirmwareUpdateRecordFields: DeviceFirmwareUpdateRecordFields;
|
|
5889
|
+
DeviceFirmwareUpdateStatusGet: DeviceFirmwareUpdateStatusGet;
|
|
5890
|
+
DeviceFirmwareUpdateStatus: DeviceFirmwareUpdateStatus;
|
|
5920
5891
|
DeviceFirmwareImageInfo: DeviceFirmwareImageInfo;
|
|
5921
5892
|
DeviceHardwareInfo: DeviceHardwareInfo;
|
|
5922
5893
|
DeviceMainMcuInfo: DeviceMainMcuInfo;
|
|
@@ -5931,9 +5902,6 @@ export type MessageType = {
|
|
|
5931
5902
|
DeviceSessionAskPassphrase: DeviceSessionAskPassphrase;
|
|
5932
5903
|
DeviceStatus: DeviceStatus;
|
|
5933
5904
|
DeviceStatusGet: DeviceStatusGet;
|
|
5934
|
-
DevOnboardingSetupStatus: DevOnboardingSetupStatus;
|
|
5935
|
-
DevGetOnboardingStatus: DevGetOnboardingStatus;
|
|
5936
|
-
DevOnboardingStatus: DevOnboardingStatus;
|
|
5937
5905
|
FilesystemPermissionFix: FilesystemPermissionFix;
|
|
5938
5906
|
FilesystemPathInfo: FilesystemPathInfo;
|
|
5939
5907
|
FilesystemPathInfoQuery: FilesystemPathInfoQuery;
|
|
@@ -5946,7 +5914,17 @@ export type MessageType = {
|
|
|
5946
5914
|
FilesystemDirMake: FilesystemDirMake;
|
|
5947
5915
|
FilesystemDirRemove: FilesystemDirRemove;
|
|
5948
5916
|
FilesystemFormat: FilesystemFormat;
|
|
5917
|
+
InternalMyAddressRequest: InternalMyAddressRequest;
|
|
5918
|
+
OnboardingSetupStatus: OnboardingSetupStatus;
|
|
5919
|
+
OnboardingStatusGet: OnboardingStatusGet;
|
|
5920
|
+
OnboardingStatus: OnboardingStatus;
|
|
5949
5921
|
PortfolioUpdate: PortfolioUpdate;
|
|
5922
|
+
ViewAmount: ViewAmount;
|
|
5923
|
+
ViewDetail: ViewDetail;
|
|
5924
|
+
ViewTip: ViewTip;
|
|
5925
|
+
ViewRawData: ViewRawData;
|
|
5926
|
+
ViewSignPage: ViewSignPage;
|
|
5927
|
+
ViewVerifyPage: ViewVerifyPage;
|
|
5950
5928
|
};
|
|
5951
5929
|
|
|
5952
5930
|
export type MessageKey = keyof MessageType;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { ProtocolType } from '../types';
|
|
2
|
+
|
|
3
|
+
const REDACTED = '[REDACTED]';
|
|
4
|
+
|
|
5
|
+
const SENSITIVE_LOG_KEYS = new Set([
|
|
6
|
+
'accesstoken',
|
|
7
|
+
'address',
|
|
8
|
+
'apikey',
|
|
9
|
+
'connectid',
|
|
10
|
+
'devicestate',
|
|
11
|
+
'deviceid',
|
|
12
|
+
'entropy',
|
|
13
|
+
'expectedpassphrasestate',
|
|
14
|
+
'mnemonic',
|
|
15
|
+
'passphrase',
|
|
16
|
+
'passphrasestate',
|
|
17
|
+
'password',
|
|
18
|
+
'pin',
|
|
19
|
+
'privatekey',
|
|
20
|
+
'publickey',
|
|
21
|
+
'seed',
|
|
22
|
+
'serialnumber',
|
|
23
|
+
'session',
|
|
24
|
+
'sessionid',
|
|
25
|
+
'signature',
|
|
26
|
+
'token',
|
|
27
|
+
'uuid',
|
|
28
|
+
'walletsessionid',
|
|
29
|
+
'xprv',
|
|
30
|
+
'xpub',
|
|
31
|
+
]);
|
|
32
|
+
|
|
33
|
+
const normalizeLogKey = (key: string) => key.replace(/[_-]/g, '').toLowerCase();
|
|
34
|
+
|
|
35
|
+
const isSensitiveLogKey = (key: string) => {
|
|
36
|
+
const normalizedKey = normalizeLogKey(key);
|
|
37
|
+
return (
|
|
38
|
+
SENSITIVE_LOG_KEYS.has(normalizedKey) ||
|
|
39
|
+
normalizedKey.endsWith('address') ||
|
|
40
|
+
normalizedKey.endsWith('privatekey') ||
|
|
41
|
+
normalizedKey.endsWith('publickey') ||
|
|
42
|
+
normalizedKey.endsWith('signature')
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const isSigningMessage = (messageName?: string) =>
|
|
47
|
+
Boolean(messageName && /(?:sign|txack|transaction)/i.test(messageName));
|
|
48
|
+
|
|
49
|
+
const redactLogValue = (value: unknown, seen: WeakSet<object>): unknown => {
|
|
50
|
+
if (ArrayBuffer.isView(value)) {
|
|
51
|
+
return `[BINARY:${value.byteLength}]`;
|
|
52
|
+
}
|
|
53
|
+
if (value instanceof ArrayBuffer) {
|
|
54
|
+
return `[BINARY:${value.byteLength}]`;
|
|
55
|
+
}
|
|
56
|
+
if (Array.isArray(value)) {
|
|
57
|
+
return value.map(item => redactLogValue(item, seen));
|
|
58
|
+
}
|
|
59
|
+
if (!value || typeof value !== 'object') {
|
|
60
|
+
return value;
|
|
61
|
+
}
|
|
62
|
+
if (seen.has(value)) {
|
|
63
|
+
return '[CIRCULAR]';
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
seen.add(value);
|
|
67
|
+
const redacted = Object.fromEntries(
|
|
68
|
+
Object.entries(value as Record<string, unknown>).map(([key, item]) => [
|
|
69
|
+
key,
|
|
70
|
+
isSensitiveLogKey(key) && item !== null && item !== undefined
|
|
71
|
+
? REDACTED
|
|
72
|
+
: redactLogValue(item, seen),
|
|
73
|
+
])
|
|
74
|
+
);
|
|
75
|
+
seen.delete(value);
|
|
76
|
+
return redacted;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export function getSafeTransportLogPayload(value: unknown, messageName?: string): unknown {
|
|
80
|
+
if (isSigningMessage(messageName)) {
|
|
81
|
+
return REDACTED;
|
|
82
|
+
}
|
|
83
|
+
return redactLogValue(value, new WeakSet());
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function createTransportCallLog(
|
|
87
|
+
name: string,
|
|
88
|
+
protocol: ProtocolType,
|
|
89
|
+
data: Record<string, unknown>
|
|
90
|
+
) {
|
|
91
|
+
return {
|
|
92
|
+
name,
|
|
93
|
+
protocol,
|
|
94
|
+
request: getSafeTransportLogPayload(data, name),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const HIGH_VOLUME_CALLS = new Set(['FileWrite', 'FilesystemFileWrite', 'EmmcFileWrite']);
|
|
99
|
+
|
|
100
|
+
export function shouldSuppressHighVolumeCallLog(name: string) {
|
|
101
|
+
return HIGH_VOLUME_CALLS.has(name);
|
|
102
|
+
}
|