• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2022 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.
14
15syntax = "proto3";
16
17package com.android.adservices.service.proto;
18
19import "google/protobuf/struct.proto";
20import "google/protobuf/timestamp.proto";
21
22// Seller's FrontEnd service.
23service SellerFrontEnd {
24  // Selects a winning ad for the Publisher ad slot that would be
25  // rendered on the user's device.
26  // TODO(b/237817698): Add rpc timeout
27  rpc SelectWinningAd(SelectWinningAdRequest)
28      returns (SelectWinningAdResponse) {}
29}
30
31// SelectWinningAdRequest is sent from user's device to the
32// SellerFrontEnd Service.
33message SelectWinningAdRequest {
34  // Unencrypted request.
35  message SelectWinningAdRawRequest {
36    enum ClientType {
37      UNKNOWN = 0;
38
39      // An Android device with Google Mobile Services (GMS).
40      // Note: This covers apps on Android and browsers on Android.
41      ANDROID = 1;
42
43      // An Android device without Google Mobile Services (GMS).
44      ANDROID_NON_GMS = 2;
45
46      // Any browser.
47      BROWSER = 3;
48    }
49
50    // AuctionConfig required by the seller for ad auction.
51    // The auction config includes contextual signals and other data required
52    // for auction. This config is passed from client to SellerFrontEnd service
53    // in the umbrella request (SelectWinningAdRequest).
54    message AuctionConfig {
55      // Custom seller inputs for advertising on Android.
56      message CustomSellerInputsForAndroid {
57        // To be updated later if any custom fields are required to support
58        // Android.
59      }
60
61      // Custom seller inputs for advertising on web.
62      message CustomSellerInputsForBrowser {
63        // This timeout can be specified to restrict the runtime (in
64        // milliseconds) of the seller's scoreAd() script for auction.
65        float seller_timeout_ms = 1;
66
67        // Optional. Component auction configuration can contain additional
68        // auction configurations for each seller's "component auction".
69        google.protobuf.Struct component_auctions = 2;
70
71        // The Id is specified by the seller to support coordinated experiments
72        // with the seller's Key/Value services.
73        int32 experiment_group_id = 3;
74      }
75
76      // Optional. Custom seller inputs.
77      oneof CustomSellerInputs {
78        CustomSellerInputsForAndroid custom_seller_inputs_android = 1;
79
80        CustomSellerInputsForBrowser custom_seller_inputs_browser = 2;
81      }
82
83      /*..........................Contextual Signals.........................*/
84      // Contextual Signals refer to seller_signals and auction_signals
85      // derived contextually.
86
87      // Seller specific signals that include information about the context
88      // (e.g. Category blocks Publisher has chosen and so on). This can
89      // not be fetched real-time from Key-Value Server.
90      // Represents a JSON object.
91      google.protobuf.Struct seller_signals = 3;
92
93      // Information about auction (ad format, size).
94      // This information is required for both bidding and auction.
95      // Represents a JSON object.
96      google.protobuf.Struct auction_signals = 4;
97    }
98
99    // Optional. Required by Android to identify an ad selection request.
100    int64 ad_selection_request_id = 1;
101
102    // Encrypted BuyerInput per buyer.
103    // The key in the map corresponds to buyer Id that can identify a buyer
104    // participating in the auction. Buyer Id can be eTLD+1; i.e. domain address
105    // (ETLD+1) of the global load balancer of Buyer Frontend Service.
106    // The value corresponds to BuyerInput ciphertext that will be ingested by
107    // the buyer for bidding.
108    map<string, bytes> encrypted_input_per_buyer = 2;
109
110    // Includes configuration data required in Remarketing ad auction.
111    // Some of the data in AuctionConfig is passed to BuyerFrontEnd.
112    AuctionConfig auction_config = 3;
113
114    // Signals about device.
115    // Required for both bidding and auction.
116    oneof DeviceSignals {
117      // A JSON object constructed by Android containing contextual
118      // information that SDK or app knows about and that adtech's bidding
119      // and auction code can ingest.
120      google.protobuf.Struct android_signals = 4;
121
122      // A JSON object constructed by the browser, containing information that
123      // the browser knows about and that adtech's bidding and auction code
124      // can ingest.
125      google.protobuf.Struct browser_signals = 5;
126    }
127
128    // Type of end user's device / client, that would help in validating the
129    // integrity of an attested client.
130    // Note: Not all types of clients will be attested.
131    ClientType client_type = 6;
132
133    // Raw (unencrypted) version of the encrypted_input_per_buyer field above.
134    // See encrypted_input_per_buyer for details.
135    // TODO(b/239242947): Remove this field and reserve, after encryption is
136    // incorporated.
137    map<string, BuyerInput> raw_buyer_input = 7;
138
139    // Field representing client attestation data will be added later.
140  }
141
142  // Encrypted SelectWinningAdRawRequest.
143  bytes request_ciphertext = 1;
144
145  // Version of the public key used for request encryption. The service
146  // needs use private keys corresponding to same key_id to decrypt
147  // 'request_ciphertext'.
148  string key_id = 2;
149
150  // Unencrypted form of the SelectWinningAdRawRequest to be used until
151  // encryption is incorporated in the client/server communication.
152  // TODO(b/239242947): Remove this field and reserve, after request
153  // encryption / decryption is complete.
154  SelectWinningAdRawRequest raw_request = 3;
155}
156
157message SelectWinningAdResponse {
158  // Unencrypted response.
159  message SelectWinningAdRawResponse {
160    // The ad that will be rendered on the end user's device. This url is
161    // validated on the client side to ensure that it actually belongs to
162    // Custom Audience (a.k.a Interest Group).
163    // Note: This could be an int32 instead given an ad can be uniquely identified
164    // by the Buyer. In that case, the device would keep the mapping of the ad
165    // identifier to ad_render_url.
166    string ad_render_url = 1;
167
168    // Score of the winning ad.
169    float score = 2;
170
171    // Custom Audience (a.k.a Interest Group) name.
172    string custom_audience_name = 3;
173
174    // Bid for the winning ad candidate, generated by a buyer participating in
175    // the auction.
176    float bid_price = 4;
177
178    // The version of the binary running on the server and Guest OS of Secure
179    // Virtual Machine. The client may validate that with the version
180    // available in open source repo.
181    string server_binary_version = 5;
182  }
183
184  // Encrypted SelectWinningAdRawResponse.
185  bytes response_ciphertext = 1;
186
187  // TODO(b/239076127): Remove this field and reserve, after request
188  // encryption / decryption is incorporated.
189  SelectWinningAdRawResponse raw_response = 2;
190}
191
192// A BuyerInput includes data that a buyer (DSP) requires to generate bids.
193message BuyerInput {
194  // CustomAudience (a.k.a InterestGroup) includes name, the set of ads
195  // corresponding to this audience, Buyer Key Value lookup keys, user bidding
196  // signals and other optional fields.
197  message CustomAudience {
198    // Name or tag of Custom Audience (a.k.a Interest Group).
199    string name = 1;
200
201    // Keys to lookup from Buyer Key/Value service.
202    // NOTE: CA name would be another lookup key besides the keys in this field.
203    repeated string bidding_signals_keys = 2;
204
205    // Buyer Key Value shard url.
206    string bidding_signals_url = 3;
207
208    // User bidding signals for storing additional metadata that the Buyer can
209    // use during bidding.
210    // NOTE: This can be passed from device or fetched from Buyer Key Value service.
211    google.protobuf.Struct user_bidding_signals = 4;
212  }
213
214  // The Custom Audiences (a.k.a Interest Groups) corresponding to the buyer.
215  repeated CustomAudience custom_audiences = 1;
216
217  // Buyer may provide additional contextual information that could help in
218  // generating bids. Not fetched real-time.
219  // Represents a JSON object.
220  google.protobuf.Struct buyer_signals = 2;
221
222  // Custom buyer inputs for advertising on Android.
223  message CustomBuyerInputsForAndroid {
224    // To be updated later if any custom fields are required to support Android.
225  }
226
227  // Custom buyer inputs for advertising on browsers.
228  message CustomBuyerInputsForBrowser {
229    // This timeout can be specified to restrict the runtime (in milliseconds)
230    // of the buyer's generateBid() scripts for bidding. This can also be a
231    // default value if timeout is unspecified for the buyer.
232    float buyer_timeout_ms = 1;
233
234    // The Id is specified by the buyer to support coordinated experiments with
235    // the buyer's Key/Value services.
236    int32 experiment_group_id = 2;
237  }
238
239  // Optional. Custom buyer input for app or web advertising.
240  oneof CustomBuyerInputs {
241    CustomBuyerInputsForAndroid custom_buyer_inputs_android = 3;
242
243    CustomBuyerInputsForBrowser custom_buyer_inputs_browser = 4;
244  }
245}
246