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 "common.proto";
19import "encrypted_message.proto";
20
21option java_multiple_files = true;
22option java_package = "com.google.cobalt";
23
24////////////////////////////////////////////////////////////////////////////////
25// NOTE: This file is used by the Cobalt client and the Cobalt servers.
26// The source-of-truth of this file is located in Google's internsl code
27// repository, and the file is copied to Android where it is used by the Cobalt
28// client. Do not edit the copy of this file in this Android repo as those edits
29// will be overwritten when the file is next copied.
30////////////////////////////////////////////////////////////////////////////////
31
32// ObservationMetadata describes the parts of an observation other than the
33// secret payload.
34message ObservationMetadata {
35  // next id: 8
36
37  // An Observation is for a particular Cobalt Report.
38  // The following four values together specify that metric.
39  uint32 customer_id = 1;
40  uint32 project_id = 2;
41  uint32 metric_id = 3;
42  uint32 report_id = 7;
43
44  // The day on which the observation occurred, expressed as the zero-based
45  // index relative to January 1, 1970.
46  // i.e. 0 = January 1, 1970
47  //      1 = January 2, 1970
48  //      etc.
49  //
50  // We intentionally leave the meaning of this vague and leave it to each
51  // Encoder Client to define how to make it precise. Which day it is depends on
52  // time zone. The Encoder client is free to use the local time zone or a
53  // different time zone. The Encoder client is free to add some random noise to
54  // the time at which an event occurred and this might change the day.
55  uint32 day_index = 4;
56
57  // The profile of the client system on which the Observation was collected.
58  SystemProfile system_profile = 5;
59
60  // We used to have a field called |backend|.
61  reserved 6;
62  reserved "backend";
63}
64
65// A batch of encrypted Observations with common metadata.
66// The Observations are encrypted to the public key of an Analyzer so the
67// Shuffler cannot read them. |Observation| is defined in Cobalt's
68// observation.proto.
69//
70// ObservationBatches are used for both input to and output from the Shuffler.
71// As input they are organized into Envelopes, each Envelope coming from some
72// client device. |Envelope| is defined in Cobalt's envelope.proto.
73//
74// The output from the Shuffler consists of shuffled
75// ObservationBatches, each ObservationBatch consisting of Observations
76// from many clients.
77//
78message ObservationBatch {
79  // The common Metadata for all of the encrypted observations in this batch.
80  ObservationMetadata meta_data = 1;
81
82  // Each EncryptedMessage contains the ciphertext of an Observation that has
83  // been encrypted to the public key of the Analyzer.
84  repeated EncryptedMessage encrypted_observation = 2;
85}
86