1// Copyright 2023 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14syntax = "proto3";
15
16package cobalt;
17
18import "observation.proto";
19import "observation_batch.proto";
20
21option java_multiple_files = true;
22option java_package = "com.google.cobalt";
23
24// A batch of unencrypted Observations with their metadata, similar to
25// ObservationBatch.
26//
27// Unlike the ObservationBatch message, the Observations are not yet encrypted.
28// UnencryptedObservationBatches are used as an intermediate object to store in
29// the DB during observation generation.
30// The Metadata for all of the observations in this batch.
31message UnencryptedObservationBatch {
32  // Data for Observations that have not yet been encrypted.
33  ObservationMetadata metadata = 1;
34  repeated ObservationToEncrypt unencrypted_observations = 2;
35}
36
37// The data for a single observation to send to the Cobalt server, similar to a
38// EncryptedMessage that contains a serialized and encrypted Observation.
39//
40// Unlike the EncryptedMessage, the Observations are not yet serialized or
41// encrypted.
42message ObservationToEncrypt {
43  // The `contribution_id` field is a cryptographically-secure random number
44  // generated and attached by the Cobalt client. The shuffler counts the
45  // number of unique ids to determine the contribution count per report.
46  //
47  // This field should only be set when the `observation` contains a Observation
48  // that should be counted towards the shuffler threshold. All other
49  // observations should not receive a `contribution_id`.
50  //
51  // Once an observation is assigned a `contribution_id` it should never be
52  // given another id.
53  bytes contribution_id = 1;
54
55  // The observation to later serialize and encrypt, to be sent to the Cobalt
56  // server.
57  Observation observation = 2;
58}
59