File: encrypted_reporting_json_keys.h

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (191 lines) | stat: -rw-r--r-- 7,447 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_REPORTING_UTIL_ENCRYPTED_REPORTING_JSON_KEYS_H_
#define COMPONENTS_REPORTING_UTIL_ENCRYPTED_REPORTING_JSON_KEYS_H_

// This file contains JSON fields for the request and response to upload
// encrypted records to the reporting server. Request fields are listed after
// the request payload example. Response fields are listed after the response
// payload example. Fields present in both the request and response are placed
// with the request fields.

namespace reporting::json_keys {

// {{Note}} ERP Request Payload Overview
// {
//   "encryptedRecord": [
//     {
//       "encryptedWrappedRecord": "EncryptedMessage",
//       "encryptionInfo" : {
//         "encryptionKey": "LocalPublicValue",
//         "publicKeyId": 1
//       },
//       "sequenceInformation": {
//         "sequencingId": 1,
//         "generationId": 123456789,
//         "priority": 1
//         // The string value of the `generationGuid` may be empty for managed
//         // ChromeOS devices or any non-ChromeOS devices, but will always have
//         // a value for unmanaged ChromeOS devices. Its value, if present,
//         // must be a string of base::Uuid. See base/uuid.h for format
//         // information.
//         "generationGuid": "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
//       },
//       "compressionInformation": {
//         "compressionAlgorithm": 1
//       }
//     },
//     {
//       "encryptedWrappedRecord": "EncryptedMessage",
//       "encryptionInfo" : {
//         "encryptionKey": "LocalPublicValue",
//         "publicKeyId": 2
//       },
//       "sequenceInformation": {
//         "sequencingId": 2,
//         "generationId": 123456789,
//         "priority": 1,
//         "generationGuid": "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
//       },
//       "compressionInformation": {
//         "compressionAlgorithm": 1
//       }
//     }
//   ],
//   // optional field, corresponding to |need_encryption_keys| in
//   // components/reporting/proto/interface.proto
//   "attachEncryptionSettings": true,
//
//   "requestId": "SomeString",
//
//   // optional field, corresponding to the configuration file version
//   // that the client is holding at the moment.
//   "configurationFileVersion": 1234,
//
//   // optional field, only used by the client tast tests to signal to the
//   // server that this is an automated test from the lab. In production, this
//   // should always be absent. Even if it is erroneously present in production
//   // code, server ignores it. Marked as string to make it reusable in the
//   // future. Value should be "tast" in the tast tests.
//   "source": "SomeString",
//
//   // optional field, not present if the device is unmanaged.
//   "device": {
//     "clientId": "abcdef1234",
//     "dmToken": "abcdef1234",
//     "name": "George",
//     "osPlatform": "Windows",
//     "osVersion": "10.0.0.0"
//   },
//
//   "browser": {
//     "browserId": "abcdef1234",
//     "chromeVersion": "10.0.0.0",
//     "machineUser": "abcdef1234",
//     "userAgent": "abcdef1234"
//   }
// }
//
// The value of an "encryptedRecord" must be a list, in which each
// element is a dictionary that represents a record. The details
// of each record is documented in record.proto.

// High level request fields
inline constexpr char kEncryptedRecordList[] = "encryptedRecord";
inline constexpr char kAttachEncryptionSettings[] = "attachEncryptionSettings";
inline constexpr char kRequestId[] = "requestId";
inline constexpr char kConfigurationFileVersion[] = "configurationFileVersion";
inline constexpr char kSource[] = "source";
inline constexpr char kDevice[] = "device";
inline constexpr char kBrowser[] = "browser";

// fields inside "encryptedRecord"
inline constexpr char kEncryptedWrappedRecord[] = "encryptedWrappedRecord";
inline constexpr char kEncryptionInfo[] = "encryptionInfo";
inline constexpr char kSequenceInformation[] = "sequenceInformation";
inline constexpr char kCompressionInformation[] = "compressionInformation";

// fields inside "encryptionInfo"
inline constexpr char kEncryptionKey[] = "encryptionKey";
inline constexpr char kPublicKeyId[] = "publicKeyId";

// fields inside "compressionInformation"
inline constexpr char kCompressionAlgorithm[] = "compressionAlgorithm";

// fields inside "sequenceInformation"
inline constexpr char kSequencingId[] = "sequencingId";
inline constexpr char kGenerationId[] = "generationId";
inline constexpr char kPriority[] = "priority";
inline constexpr char kGenerationGuid[] = "generationGuid";

// fields inside "device"
inline constexpr char kClientId[] = "clientId";
inline constexpr char kDmToken[] = "dmToken";
inline constexpr char kDeviceName[] = "name";
inline constexpr char kOsPlatform[] = "osPlatform";
inline constexpr char kOsVersion[] = "osVersion";

// fields inside "browser"
inline constexpr char kBrowserId[] = "browserId";
inline constexpr char kChromeVersion[] = "chromeVersion";
inline constexpr char kMachineUser[] = "machineUser";
inline constexpr char kUserAgent[] = "userAgent";

// {{{Note}}} ERP Response Payload Overview
//
//  {
//    "lastSucceedUploadedRecord": ... // SequenceInformation proto
//    "firstFailedUploadedRecord": {
//      "failedUploadedRecord": ... // SequenceInformation proto
//      "failureStatus": ... // Status proto
//    },
//    "encryptionSettings": ... // EncryptionSettings proto
//    "forceConfirm": true, // if present, flag that lastSucceedUploadedRecord
//                          // is to be accepted unconditionally by client
//    "configurationFile": ... // ConfigurationFile proto
//    // Internal control
//    "enableUploadSizeAdjustment": true,  // If present, upload size
//                                         // adjustment is enabled.
//  }

// Succeeded upload
inline constexpr char kLastSucceedUploadedRecord[] =
    "lastSucceedUploadedRecord";

// Failed upload
inline constexpr char kFirstFailedUploadedRecord[] =
    "firstFailedUploadedRecord";
inline constexpr char kFailedUploadedRecord[] = "failedUploadedRecord";
inline constexpr char kFailureStatus[] = "failureStatus";
inline constexpr char kErrorCode[] = "code";
inline constexpr char kErrorMessage[] = "message";

// Encryption settings
inline constexpr char kEncryptionSettings[] = "encryptionSettings";

// Force confirm
inline constexpr char kForceConfirm[] = "forceConfirm";

// Configuration file proto
inline constexpr char kConfigurationFile[] = "configurationFile";
inline constexpr char kConfigurationFileSignature[] = "configFileSignature";
inline constexpr char kConfigurationFileMinimumReleaseVersion[] =
    "minimumReleaseVersion";
inline constexpr char kConfigurationFileMaximumReleaseVersion[] =
    "maximumReleaseVersion";
inline constexpr char kConfigurationFileDestination[] = "destination";
inline constexpr char kConfigurationFileVersionResponse[] = "version";
inline constexpr char kBlockedEventConfigs[] = "blockedEventConfigs";

// Public key
inline constexpr char kPublicKey[] = "publicKey";
inline constexpr char kPublicKeySignature[] = "publicKeySignature";

// Enable upload size adjustment
inline constexpr char kEnableUploadSizeAdjustment[] =
    "enableUploadSizeAdjustment";

}  // namespace reporting::json_keys

#endif  // COMPONENTS_REPORTING_UTIL_ENCRYPTED_REPORTING_JSON_KEYS_H_