@onekeyfe/hd-transport 1.2.8-alpha.126 → 1.2.8-alpha.128
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__/transport-log.test.js +142 -0
- package/dist/index.d.ts +68 -1
- package/dist/index.js +26 -2
- package/dist/types/messages.d.ts +47 -0
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/utils/transportLog.d.ts.map +1 -1
- package/messages-protocol-v2.json +138 -1
- package/package.json +2 -2
- package/src/types/messages.ts +63 -0
- package/src/utils/transportLog.ts +16 -2
|
@@ -11034,6 +11034,61 @@
|
|
|
11034
11034
|
}
|
|
11035
11035
|
}
|
|
11036
11036
|
},
|
|
11037
|
+
"ZcashSignPczt": {
|
|
11038
|
+
"fields": {
|
|
11039
|
+
"pczt_length": {
|
|
11040
|
+
"rule": "required",
|
|
11041
|
+
"type": "uint32",
|
|
11042
|
+
"id": 1
|
|
11043
|
+
},
|
|
11044
|
+
"pczt_initial_chunk": {
|
|
11045
|
+
"rule": "required",
|
|
11046
|
+
"type": "bytes",
|
|
11047
|
+
"id": 2
|
|
11048
|
+
}
|
|
11049
|
+
}
|
|
11050
|
+
},
|
|
11051
|
+
"ZcashPcztChunkRequest": {
|
|
11052
|
+
"fields": {
|
|
11053
|
+
"chunk_length": {
|
|
11054
|
+
"rule": "required",
|
|
11055
|
+
"type": "uint32",
|
|
11056
|
+
"id": 1
|
|
11057
|
+
}
|
|
11058
|
+
}
|
|
11059
|
+
},
|
|
11060
|
+
"ZcashPcztChunkAck": {
|
|
11061
|
+
"fields": {
|
|
11062
|
+
"data_chunk": {
|
|
11063
|
+
"rule": "required",
|
|
11064
|
+
"type": "bytes",
|
|
11065
|
+
"id": 1
|
|
11066
|
+
}
|
|
11067
|
+
}
|
|
11068
|
+
},
|
|
11069
|
+
"ZcashSignedPczt": {
|
|
11070
|
+
"fields": {
|
|
11071
|
+
"pczt_length": {
|
|
11072
|
+
"rule": "required",
|
|
11073
|
+
"type": "uint32",
|
|
11074
|
+
"id": 1
|
|
11075
|
+
},
|
|
11076
|
+
"pczt_initial_chunk": {
|
|
11077
|
+
"rule": "required",
|
|
11078
|
+
"type": "bytes",
|
|
11079
|
+
"id": 2
|
|
11080
|
+
}
|
|
11081
|
+
}
|
|
11082
|
+
},
|
|
11083
|
+
"ZcashSignedPcztChunkRequest": {
|
|
11084
|
+
"fields": {
|
|
11085
|
+
"chunk_length": {
|
|
11086
|
+
"rule": "required",
|
|
11087
|
+
"type": "uint32",
|
|
11088
|
+
"id": 1
|
|
11089
|
+
}
|
|
11090
|
+
}
|
|
11091
|
+
},
|
|
11037
11092
|
"wire_in": {
|
|
11038
11093
|
"type": "bool",
|
|
11039
11094
|
"id": 50002,
|
|
@@ -11459,6 +11514,11 @@
|
|
|
11459
11514
|
"MessageType_NeoAddress": 12302,
|
|
11460
11515
|
"MessageType_NeoSignTx": 12303,
|
|
11461
11516
|
"MessageType_NeoSignedTx": 12304,
|
|
11517
|
+
"MessageType_ZcashSignPczt": 12402,
|
|
11518
|
+
"MessageType_ZcashSignedPczt": 12403,
|
|
11519
|
+
"MessageType_ZcashPcztChunkRequest": 12404,
|
|
11520
|
+
"MessageType_ZcashPcztChunkAck": 12405,
|
|
11521
|
+
"MessageType_ZcashSignedPcztChunkRequest": 12406,
|
|
11462
11522
|
"MessageType_DeviceFactoryInfoSet": 60000,
|
|
11463
11523
|
"MessageType_DeviceFactoryInfoGet": 60001,
|
|
11464
11524
|
"MessageType_DeviceFactoryInfo": 60002,
|
|
@@ -11511,7 +11571,9 @@
|
|
|
11511
11571
|
"MessageType_PortfolioUpdate": 61400,
|
|
11512
11572
|
"MessageType_NftUpdate": 61500,
|
|
11513
11573
|
"MessageType_OnboardingStatusGet": 61600,
|
|
11514
|
-
"MessageType_OnboardingStatus": 61601
|
|
11574
|
+
"MessageType_OnboardingStatus": 61601,
|
|
11575
|
+
"MessageType_ZcashGetAddress": 12400,
|
|
11576
|
+
"MessageType_ZcashAddress": 12401
|
|
11515
11577
|
},
|
|
11516
11578
|
"reserved": [
|
|
11517
11579
|
[90, 92],
|
|
@@ -13730,6 +13792,81 @@
|
|
|
13730
13792
|
}
|
|
13731
13793
|
}
|
|
13732
13794
|
}
|
|
13795
|
+
},
|
|
13796
|
+
"ZcashAddressType": {
|
|
13797
|
+
"values": {
|
|
13798
|
+
"UNIFIED_ORCHARD_P2PKH": 0,
|
|
13799
|
+
"TRANSPARENT_P2PKH": 1,
|
|
13800
|
+
"UNIFIED_ORCHARD": 2
|
|
13801
|
+
}
|
|
13802
|
+
},
|
|
13803
|
+
"ZcashAddressScope": {
|
|
13804
|
+
"values": {
|
|
13805
|
+
"EXTERNAL": 0,
|
|
13806
|
+
"INTERNAL": 1
|
|
13807
|
+
}
|
|
13808
|
+
},
|
|
13809
|
+
"ZcashGetAddress": {
|
|
13810
|
+
"fields": {
|
|
13811
|
+
"address_n": {
|
|
13812
|
+
"rule": "repeated",
|
|
13813
|
+
"type": "uint32",
|
|
13814
|
+
"id": 1,
|
|
13815
|
+
"options": {
|
|
13816
|
+
"packed": false
|
|
13817
|
+
}
|
|
13818
|
+
},
|
|
13819
|
+
"show_display": {
|
|
13820
|
+
"type": "bool",
|
|
13821
|
+
"id": 2
|
|
13822
|
+
},
|
|
13823
|
+
"include_seed_fingerprint": {
|
|
13824
|
+
"type": "bool",
|
|
13825
|
+
"id": 3
|
|
13826
|
+
},
|
|
13827
|
+
"include_ufvk": {
|
|
13828
|
+
"type": "bool",
|
|
13829
|
+
"id": 4
|
|
13830
|
+
},
|
|
13831
|
+
"diversifier_index": {
|
|
13832
|
+
"type": "uint32",
|
|
13833
|
+
"id": 5,
|
|
13834
|
+
"options": {
|
|
13835
|
+
"default": 0
|
|
13836
|
+
}
|
|
13837
|
+
},
|
|
13838
|
+
"address_type": {
|
|
13839
|
+
"type": "ZcashAddressType",
|
|
13840
|
+
"id": 6,
|
|
13841
|
+
"options": {
|
|
13842
|
+
"default": "UNIFIED_ORCHARD_P2PKH"
|
|
13843
|
+
}
|
|
13844
|
+
},
|
|
13845
|
+
"scope": {
|
|
13846
|
+
"type": "ZcashAddressScope",
|
|
13847
|
+
"id": 7,
|
|
13848
|
+
"options": {
|
|
13849
|
+
"default": "EXTERNAL"
|
|
13850
|
+
}
|
|
13851
|
+
}
|
|
13852
|
+
}
|
|
13853
|
+
},
|
|
13854
|
+
"ZcashAddress": {
|
|
13855
|
+
"fields": {
|
|
13856
|
+
"address": {
|
|
13857
|
+
"rule": "required",
|
|
13858
|
+
"type": "string",
|
|
13859
|
+
"id": 1
|
|
13860
|
+
},
|
|
13861
|
+
"ufvk": {
|
|
13862
|
+
"type": "string",
|
|
13863
|
+
"id": 2
|
|
13864
|
+
},
|
|
13865
|
+
"seed_fingerprint": {
|
|
13866
|
+
"type": "bytes",
|
|
13867
|
+
"id": 3
|
|
13868
|
+
}
|
|
13869
|
+
}
|
|
13733
13870
|
}
|
|
13734
13871
|
}
|
|
13735
13872
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-transport",
|
|
3
|
-
"version": "1.2.8-alpha.
|
|
3
|
+
"version": "1.2.8-alpha.128",
|
|
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": "201fda4da9c555f545ff4a776e79abf090ba8bf8"
|
|
32
32
|
}
|
package/src/types/messages.ts
CHANGED
|
@@ -4680,6 +4680,33 @@ export type UiAnimationRequest = {
|
|
|
4680
4680
|
type?: UiAnimationType;
|
|
4681
4681
|
};
|
|
4682
4682
|
|
|
4683
|
+
// ZcashSignPczt
|
|
4684
|
+
export type ZcashSignPczt = {
|
|
4685
|
+
pczt_length: number;
|
|
4686
|
+
pczt_initial_chunk: string;
|
|
4687
|
+
};
|
|
4688
|
+
|
|
4689
|
+
// ZcashPcztChunkRequest
|
|
4690
|
+
export type ZcashPcztChunkRequest = {
|
|
4691
|
+
chunk_length: number;
|
|
4692
|
+
};
|
|
4693
|
+
|
|
4694
|
+
// ZcashPcztChunkAck
|
|
4695
|
+
export type ZcashPcztChunkAck = {
|
|
4696
|
+
data_chunk: string;
|
|
4697
|
+
};
|
|
4698
|
+
|
|
4699
|
+
// ZcashSignedPczt
|
|
4700
|
+
export type ZcashSignedPczt = {
|
|
4701
|
+
pczt_length: number;
|
|
4702
|
+
pczt_initial_chunk: string;
|
|
4703
|
+
};
|
|
4704
|
+
|
|
4705
|
+
// ZcashSignedPcztChunkRequest
|
|
4706
|
+
export type ZcashSignedPcztChunkRequest = {
|
|
4707
|
+
chunk_length: number;
|
|
4708
|
+
};
|
|
4709
|
+
|
|
4683
4710
|
// experimental_message
|
|
4684
4711
|
export type experimental_message = {};
|
|
4685
4712
|
|
|
@@ -5374,6 +5401,35 @@ export type ViewVerifyPage = {
|
|
|
5374
5401
|
content?: ViewContentPreview;
|
|
5375
5402
|
};
|
|
5376
5403
|
|
|
5404
|
+
export enum ZcashAddressType {
|
|
5405
|
+
UNIFIED_ORCHARD_P2PKH = 0,
|
|
5406
|
+
TRANSPARENT_P2PKH = 1,
|
|
5407
|
+
UNIFIED_ORCHARD = 2,
|
|
5408
|
+
}
|
|
5409
|
+
|
|
5410
|
+
export enum ZcashAddressScope {
|
|
5411
|
+
EXTERNAL = 0,
|
|
5412
|
+
INTERNAL = 1,
|
|
5413
|
+
}
|
|
5414
|
+
|
|
5415
|
+
// ZcashGetAddress
|
|
5416
|
+
export type ZcashGetAddress = {
|
|
5417
|
+
address_n: number[];
|
|
5418
|
+
show_display?: boolean;
|
|
5419
|
+
include_seed_fingerprint?: boolean;
|
|
5420
|
+
include_ufvk?: boolean;
|
|
5421
|
+
diversifier_index?: number;
|
|
5422
|
+
address_type?: ZcashAddressType;
|
|
5423
|
+
scope?: ZcashAddressScope;
|
|
5424
|
+
};
|
|
5425
|
+
|
|
5426
|
+
// ZcashAddress
|
|
5427
|
+
export type ZcashAddress = {
|
|
5428
|
+
address: string;
|
|
5429
|
+
ufvk?: string;
|
|
5430
|
+
seed_fingerprint?: string;
|
|
5431
|
+
};
|
|
5432
|
+
|
|
5377
5433
|
export enum ProtocolV2FailureType {
|
|
5378
5434
|
Failure_InvalidMessage = 1,
|
|
5379
5435
|
Failure_UndefinedError = 2,
|
|
@@ -5988,6 +6044,11 @@ export type MessageType = {
|
|
|
5988
6044
|
UnlockPath: UnlockPath;
|
|
5989
6045
|
UnlockedPathRequest: UnlockedPathRequest;
|
|
5990
6046
|
UiAnimationRequest: UiAnimationRequest;
|
|
6047
|
+
ZcashSignPczt: ZcashSignPczt;
|
|
6048
|
+
ZcashPcztChunkRequest: ZcashPcztChunkRequest;
|
|
6049
|
+
ZcashPcztChunkAck: ZcashPcztChunkAck;
|
|
6050
|
+
ZcashSignedPczt: ZcashSignedPczt;
|
|
6051
|
+
ZcashSignedPcztChunkRequest: ZcashSignedPcztChunkRequest;
|
|
5991
6052
|
experimental_message: experimental_message;
|
|
5992
6053
|
experimental_field: experimental_field;
|
|
5993
6054
|
ProtocolInfoRequest: ProtocolInfoRequest;
|
|
@@ -6064,6 +6125,8 @@ export type MessageType = {
|
|
|
6064
6125
|
ViewSignPage: ViewSignPage;
|
|
6065
6126
|
ViewWarningPage: ViewWarningPage;
|
|
6066
6127
|
ViewVerifyPage: ViewVerifyPage;
|
|
6128
|
+
ZcashGetAddress: ZcashGetAddress;
|
|
6129
|
+
ZcashAddress: ZcashAddress;
|
|
6067
6130
|
};
|
|
6068
6131
|
|
|
6069
6132
|
export type MessageKey = keyof MessageType;
|
|
@@ -4,29 +4,39 @@ const REDACTED = '[REDACTED]';
|
|
|
4
4
|
|
|
5
5
|
const SENSITIVE_LOG_KEYS = new Set([
|
|
6
6
|
'accesstoken',
|
|
7
|
+
'additionaltxpubkeys',
|
|
7
8
|
'address',
|
|
8
9
|
'apikey',
|
|
9
10
|
'connectid',
|
|
11
|
+
'datachunk',
|
|
10
12
|
'devicestate',
|
|
11
13
|
'deviceid',
|
|
14
|
+
'enckey',
|
|
12
15
|
'entropy',
|
|
13
16
|
'expectedpassphrasestate',
|
|
14
17
|
'mnemonic',
|
|
18
|
+
'outkey',
|
|
15
19
|
'passphrase',
|
|
16
20
|
'passphrasestate',
|
|
17
21
|
'password',
|
|
22
|
+
'pczt',
|
|
18
23
|
'pin',
|
|
19
24
|
'privatekey',
|
|
20
25
|
'publickey',
|
|
21
26
|
'seed',
|
|
22
27
|
'secret',
|
|
28
|
+
'seedfingerprint',
|
|
23
29
|
'serialnumber',
|
|
24
30
|
'session',
|
|
25
31
|
'sessionid',
|
|
26
32
|
'signature',
|
|
33
|
+
'signedpczt',
|
|
27
34
|
'token',
|
|
35
|
+
'txpubkey',
|
|
36
|
+
'ufvk',
|
|
28
37
|
'uuid',
|
|
29
38
|
'walletsessionid',
|
|
39
|
+
'watchkey',
|
|
30
40
|
'xprv',
|
|
31
41
|
'xpub',
|
|
32
42
|
]);
|
|
@@ -45,7 +55,11 @@ const isSensitiveLogKey = (key: string) => {
|
|
|
45
55
|
};
|
|
46
56
|
|
|
47
57
|
const isSigningMessage = (messageName?: string) =>
|
|
48
|
-
Boolean(messageName && /(?:sign|txack|transaction)/i.test(messageName));
|
|
58
|
+
Boolean(messageName && /(?:sign|txack|transaction|pczt)/i.test(messageName));
|
|
59
|
+
|
|
60
|
+
// Key image and tx key exchanges carry per-output secrets under generic field names (iv, blob, salt).
|
|
61
|
+
const isMoneroSecretMessage = (messageName?: string) =>
|
|
62
|
+
Boolean(messageName && /^Monero(?:KeyImage|GetTxKey|LiveRefresh)/.test(messageName));
|
|
49
63
|
|
|
50
64
|
const redactLogValue = (value: unknown, seen: WeakSet<object>): unknown => {
|
|
51
65
|
if (ArrayBuffer.isView(value)) {
|
|
@@ -78,7 +92,7 @@ const redactLogValue = (value: unknown, seen: WeakSet<object>): unknown => {
|
|
|
78
92
|
};
|
|
79
93
|
|
|
80
94
|
export function getSafeTransportLogPayload(value: unknown, messageName?: string): unknown {
|
|
81
|
-
if (isSigningMessage(messageName)) {
|
|
95
|
+
if (isSigningMessage(messageName) || isMoneroSecretMessage(messageName)) {
|
|
82
96
|
return REDACTED;
|
|
83
97
|
}
|
|
84
98
|
return redactLogValue(value, new WeakSet());
|