// 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[] = …; inline constexpr char kAttachEncryptionSettings[] = …; inline constexpr char kRequestId[] = …; inline constexpr char kConfigurationFileVersion[] = …; inline constexpr char kSource[] = …; inline constexpr char kDevice[] = …; inline constexpr char kBrowser[] = …; // fields inside "encryptedRecord" inline constexpr char kEncryptedWrappedRecord[] = …; inline constexpr char kEncryptionInfo[] = …; inline constexpr char kSequenceInformation[] = …; inline constexpr char kCompressionInformation[] = …; // fields inside "encryptionInfo" inline constexpr char kEncryptionKey[] = …; inline constexpr char kPublicKeyId[] = …; // fields inside "compressionInformation" inline constexpr char kCompressionAlgorithm[] = …; // fields inside "sequenceInformation" inline constexpr char kSequencingId[] = …; inline constexpr char kGenerationId[] = …; inline constexpr char kPriority[] = …; inline constexpr char kGenerationGuid[] = …; // fields inside "device" inline constexpr char kClientId[] = …; inline constexpr char kDmToken[] = …; inline constexpr char kDeviceName[] = …; inline constexpr char kOsPlatform[] = …; inline constexpr char kOsVersion[] = …; // fields inside "browser" inline constexpr char kBrowserId[] = …; inline constexpr char kChromeVersion[] = …; inline constexpr char kMachineUser[] = …; inline constexpr char kUserAgent[] = …; // {{{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[] = …; // Failed upload inline constexpr char kFirstFailedUploadedRecord[] = …; inline constexpr char kFailedUploadedRecord[] = …; inline constexpr char kFailureStatus[] = …; inline constexpr char kErrorCode[] = …; inline constexpr char kErrorMessage[] = …; // Encryption settings inline constexpr char kEncryptionSettings[] = …; // Force confirm inline constexpr char kForceConfirm[] = …; // Configuration file proto inline constexpr char kConfigurationFile[] = …; inline constexpr char kConfigurationFileSignature[] = …; inline constexpr char kConfigurationFileMinimumReleaseVersion[] = …; inline constexpr char kConfigurationFileMaximumReleaseVersion[] = …; inline constexpr char kConfigurationFileDestination[] = …; inline constexpr char kConfigurationFileVersionResponse[] = …; inline constexpr char kBlockedEventConfigs[] = …; // Public key inline constexpr char kPublicKey[] = …; inline constexpr char kPublicKeySignature[] = …; // Enable upload size adjustment inline constexpr char kEnableUploadSizeAdjustment[] = …; } // namespace reporting::json_keys #endif // COMPONENTS_REPORTING_UTIL_ENCRYPTED_REPORTING_JSON_KEYS_H_