1/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
18package android.adservices.service;
19
20option java_outer_classname = "FledgeProtoEnums";
21option java_multiple_files = true;
22
23/**
24 * Script language type.
25 */
26enum ScriptType {
27  UNSET = 0;
28  JAVASCRIPT = 1;
29  WASM = 2;
30}
31
32// Logs the type of beacon reporting destination.
33enum BeaconReportingDestinationType {
34  UNSET_DESTINATION = 0;
35  SELLER_DESTINATION = 1;
36  BUYER_DESTINATION = 2;
37  SELLER_AND_BUYER_DESTINATION = 3;
38}
39
40// Results of signature verification process.
41enum VerificationStatus {
42    UNKNOWN = 0;
43    VERIFICATION_FAILED = 1;
44    VERIFIED = 2;
45}
46
47// The result code of a K-Anon Job (triggered immediately after auction or via background job)
48enum KAnonJobResult {
49  KANON_JOB_RESULT_UNSET = 0;
50  KANON_JOB_RESULT_INITIALIZE_FAILED = 1;
51  KANON_JOB_RESULT_SOME_OR_ALL_SIGN_FAILED = 2;
52  KANON_JOB_RESULT_SOME_OR_ALL_JOIN_FAILED = 3;
53  KANON_JOB_RESULT_SUCCESS = 4;
54}
55
56// The result code of an individual K-Anon action
57enum KAnonActionResult {
58  KANON_ACTION_FAILURE_REASON_UNSET = 0;
59  KANON_ACTION_FAILURE_REASON_NETWORK_EXCEPTION = 1; // 404 for example
60  KANON_ACTION_FAILURE_REASON_SERVER_EXCEPTION = 2; // Server failed our request
61  KANON_ACTION_FAILURE_REASON_PROTO_PARSE_EXCEPTION = 3;  // Couldn't parse proto. Most likely if Server returned a malformed response
62  KANON_ACTION_FAILURE_REASON_INTERNAL_ERROR = 4;  // A non-proto or server related error, internal to implementation
63  KANON_ACTION_FAILURE_REASON_UNKNOWN_ERROR = 5;
64}
65
66// Lists all the type of different KAnon actions
67enum KAnonAction {
68  KANON_ACTION_UNSET = 0;
69  // 1 - 7 are actions required to initialize a K-Anon Caller
70  KANON_ACTION_GET_CHALLENGE_HTTP_CALL = 1;
71  KANON_ACTION_KEY_ATTESTATION_CERT_GENERATION = 2;
72  KANON_ACTION_SERVER_PARAM_HTTP_CALL = 3;
73  KANON_ACTION_SERVER_PUBLIC_PARAMS_PROTO_COMPOSITION = 4;
74  KANON_ACTION_GENERATE_CLIENT_PARAM_ACT = 5;
75  KANON_ACTION_REGISTER_CLIENT_HTTP_CALL = 6;
76  KANON_ACTION_REGISTER_CLIENT_RESPONSE_PROTO_COMPOSITION = 7;
77
78  // Following are various actions required to perform the sign and join calls
79  KANON_ACTION_GENERATE_TOKENS_REQUEST_ACT = 8;
80  KANON_ACTION_GET_TOKENS_REQUEST_HTTP_CALL = 9;
81  KANON_ACTION_GET_TOKENS_RESPONSE_PROTO_COMPOSITION = 10;
82  KANON_ACTION_VERIFY_TOKENS_RESPONSE_ACT = 11;
83  KANON_ACTION_RECOVER_TOKENS_ACT = 12;
84  KANON_ACTION_JOIN_HTTP_CALL = 13;
85
86}
87
88// The result of a KAnon Key Attestation action
89enum KAnonKeyAttestationResult {
90  KEY_ATTESTATION_RESULT_UNSET = 0;
91  KEY_ATTESTATION_RESULT_KEYSTORE_EXCEPTION = 1;
92  KEY_ATTESTATION_RESULT_ILLEGAL_STATE_EXCEPTION = 2;
93  KEY_ATTESTATION_RESULT_CERTIFICATE_EXCEPTION = 3;
94  KEY_ATTESTATION_RESULT_IO_EXCEPTION = 4;
95  KEY_ATTESTATION_RESULT_NO_SUCH_ALGORITHM_EXCEPTION = 5;
96  KEY_ATTESTATION_RESULT_SUCCESS = 6;
97}
98
99// Leaving these not tied to specific numbers gives us flexibility to change them later
100enum Size {
101    UNSET_SIZE = 0;
102    VERY_SMALL = 1;
103    SMALL = 2;
104    MEDIUM = 3;
105    LARGE = 4;
106    VERY_LARGE = 5;
107}
108
109enum ServerAuctionKeyFetchSource {
110  SERVER_AUCTION_KEY_FETCH_SOURCE_UNSET = 0;
111  SERVER_AUCTION_KEY_FETCH_SOURCE_BACKGROUND_FETCH = 1;
112  SERVER_AUCTION_KEY_FETCH_SOURCE_AUCTION = 2;
113}
114
115enum BackgroundKeyFetchStatus {
116  BACKGROUND_KEY_FETCH_STATUS_UNSET = 0;
117  BACKGROUND_KEY_FETCH_STATUS_NO_OP = 1;
118  BACKGROUND_KEY_FETCH_STATUS_REFRESH_KEYS_INITIATED = 2;
119}
120
121enum ServerAuctionCoordinatorSource {
122  SERVER_AUCTION_COORDINATOR_SOURCE_UNSET = 0;
123  SERVER_AUCTION_COORDINATOR_SOURCE_DEFAULT = 1;
124  SERVER_AUCTION_COORDINATOR_SOURCE_API = 2;
125}
126
127enum ServerAuctionEncryptionKeySource {
128  SERVER_AUCTION_ENCRYPTION_KEY_SOURCE_UNSET = 0;
129  SERVER_AUCTION_ENCRYPTION_KEY_SOURCE_DATABASE = 1;
130  SERVER_AUCTION_ENCRYPTION_KEY_SOURCE_NETWORK = 2;
131}
132
133enum JsRunStatus {
134    UNSET_STATUS = 0;
135    SUCCESS = 1;
136    TIMEOUT = 2;
137    JS_SYNTAX_ERROR = 3;
138    OUTPUT_SYNTAX_ERROR = 4;
139    OUTPUT_SEMANTIC_ERROR = 5;
140    OUTPUT_NON_ZERO_RESULT = 6;
141    DB_PERSIST_FAILURE = 7;
142    OTHER_FAILURE = 8;
143    REFERENCE_ERROR = 9;
144}
145
146