@onekeyfe/hd-transport 1.2.8 → 1.2.10-alpha.1
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__/babylon-context-hash.test.js +44 -0
- package/__tests__/protocol-v2-file-write-pipeline.test.js +478 -0
- package/__tests__/protocol-v2.test.js +3 -3
- package/__tests__/transport-log.test.js +166 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/index.d.ts +147 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +253 -72
- package/dist/protocols/v2/session.d.ts +7 -1
- package/dist/protocols/v2/session.d.ts.map +1 -1
- package/dist/types/messages.d.ts +66 -0
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/types/transport.d.ts +6 -0
- package/dist/types/transport.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/scripts/protobuf-build.sh +30 -0
- package/scripts/protobuf-types.js +1 -0
- package/src/constants.ts +10 -1
- package/src/index.ts +1 -0
- package/src/protocols/v2/session.ts +326 -96
- package/src/types/messages.ts +87 -0
- package/src/types/transport.ts +25 -0
- package/src/utils/transportLog.ts +17 -2
|
@@ -4,28 +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',
|
|
27
|
+
'secret',
|
|
28
|
+
'seedfingerprint',
|
|
22
29
|
'serialnumber',
|
|
23
30
|
'session',
|
|
24
31
|
'sessionid',
|
|
25
32
|
'signature',
|
|
33
|
+
'signedpczt',
|
|
26
34
|
'token',
|
|
35
|
+
'txpubkey',
|
|
36
|
+
'ufvk',
|
|
27
37
|
'uuid',
|
|
28
38
|
'walletsessionid',
|
|
39
|
+
'watchkey',
|
|
29
40
|
'xprv',
|
|
30
41
|
'xpub',
|
|
31
42
|
]);
|
|
@@ -44,7 +55,11 @@ const isSensitiveLogKey = (key: string) => {
|
|
|
44
55
|
};
|
|
45
56
|
|
|
46
57
|
const isSigningMessage = (messageName?: string) =>
|
|
47
|
-
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));
|
|
48
63
|
|
|
49
64
|
const redactLogValue = (value: unknown, seen: WeakSet<object>): unknown => {
|
|
50
65
|
if (ArrayBuffer.isView(value)) {
|
|
@@ -77,7 +92,7 @@ const redactLogValue = (value: unknown, seen: WeakSet<object>): unknown => {
|
|
|
77
92
|
};
|
|
78
93
|
|
|
79
94
|
export function getSafeTransportLogPayload(value: unknown, messageName?: string): unknown {
|
|
80
|
-
if (isSigningMessage(messageName)) {
|
|
95
|
+
if (isSigningMessage(messageName) || isMoneroSecretMessage(messageName)) {
|
|
81
96
|
return REDACTED;
|
|
82
97
|
}
|
|
83
98
|
return redactLogValue(value, new WeakSet());
|