1*a26f1301SXin Li/* 2*a26f1301SXin Li * Copyright 2023 Google LLC. 3*a26f1301SXin Li * Licensed under the Apache License, Version 2.0 (the "License"); 4*a26f1301SXin Li * you may not use this file except in compliance with the License. 5*a26f1301SXin Li * You may obtain a copy of the License at 6*a26f1301SXin Li * 7*a26f1301SXin Li * https://www.apache.org/licenses/LICENSE-2.0 8*a26f1301SXin Li * 9*a26f1301SXin Li * Unless required by applicable law or agreed to in writing, software 10*a26f1301SXin Li * distributed under the License is distributed on an "AS IS" BASIS, 11*a26f1301SXin Li * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*a26f1301SXin Li * See the License for the specific language governing permissions and 13*a26f1301SXin Li * limitations under the License. 14*a26f1301SXin Li */ 15*a26f1301SXin Li 16*a26f1301SXin Lisyntax = "proto3"; 17*a26f1301SXin Li 18*a26f1301SXin Lipackage private_join_and_compute.anonymous_counting_tokens; 19*a26f1301SXin Li 20*a26f1301SXin Liimport "act/act.proto"; 21*a26f1301SXin Liimport "google/protobuf/timestamp.proto"; 22*a26f1301SXin Li 23*a26f1301SXin Li 24*a26f1301SXin Lioption java_multiple_files = true; 25*a26f1301SXin Li 26*a26f1301SXin Limessage Transcript { 27*a26f1301SXin Li SchemeParameters scheme_parameters = 1; 28*a26f1301SXin Li ServerParameters server_parameters = 2; 29*a26f1301SXin Li ClientParameters client_parameters = 3; 30*a26f1301SXin Li repeated string messages = 4; 31*a26f1301SXin Li repeated bytes fingerprints = 5; 32*a26f1301SXin Li TokensRequest tokens_request = 6; 33*a26f1301SXin Li TokensRequestPrivateState tokens_request_private_state = 7; 34*a26f1301SXin Li TokensResponse tokens_response = 8; 35*a26f1301SXin Li repeated Token tokens = 9; 36*a26f1301SXin Li} 37*a26f1301SXin Li 38*a26f1301SXin Limessage MessagesSet { 39*a26f1301SXin Li repeated string message = 1; 40*a26f1301SXin Li} 41*a26f1301SXin Li 42*a26f1301SXin Limessage GeneratedTokensRequestProto { 43*a26f1301SXin Li repeated bytes fingerprints_bytes = 1; 44*a26f1301SXin Li TokensRequest token_request = 2; 45*a26f1301SXin Li TokensRequestPrivateState tokens_request_private_state = 3; 46*a26f1301SXin Li} 47*a26f1301SXin Li 48*a26f1301SXin Limessage TokensSet { 49*a26f1301SXin Li repeated Token tokens = 1; 50*a26f1301SXin Li} 51*a26f1301SXin Li 52*a26f1301SXin Limessage Timestamp { 53*a26f1301SXin Li // Represents seconds of UTC time since Unix epoch 54*a26f1301SXin Li // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 55*a26f1301SXin Li // 9999-12-31T23:59:59Z inclusive. 56*a26f1301SXin Li int64 seconds = 1; 57*a26f1301SXin Li 58*a26f1301SXin Li // Non-negative fractions of a second at nanosecond resolution. Negative 59*a26f1301SXin Li // second values with fractions must still have non-negative nanos values 60*a26f1301SXin Li // that count forward in time. Must be from 0 to 999,999,999 61*a26f1301SXin Li // inclusive. 62*a26f1301SXin Li int32 nanos = 2; 63*a26f1301SXin Li} 64*a26f1301SXin Li 65*a26f1301SXin Li 66*a26f1301SXin Li// Server public params request. 67*a26f1301SXin Limessage GetServerPublicParamsRequest { 68*a26f1301SXin Li // The response should contain the latest server params corresponding to this 69*a26f1301SXin Li // scheme_params_version. 70*a26f1301SXin Li string scheme_params_version = 1; 71*a26f1301SXin Li} 72*a26f1301SXin Li 73*a26f1301SXin Li// Server public params response. 74*a26f1301SXin Limessage GetServerPublicParamsResponse { 75*a26f1301SXin Li // The name of the return parameters, to be used in subsequent token requests. 76*a26f1301SXin Li string server_params_version = 1; 77*a26f1301SXin Li ServerPublicParameters server_public_params = 2; 78*a26f1301SXin Li // The time when tokens can be requested for these parameters. 79*a26f1301SXin Li // After this expires, clients registered with these server params must 80*a26f1301SXin Li // re-register with a new unexpired server_params. 81*a26f1301SXin Li Timestamp server_params_sign_expiry = 3; 82*a26f1301SXin Li // The time when tokens can be redeemed for these parameters. 83*a26f1301SXin Li Timestamp server_params_join_expiry = 4; 84*a26f1301SXin Li} 85*a26f1301SXin Li 86*a26f1301SXin Limessage RequestMetadata { 87*a26f1301SXin Li // AuthType decouples the authentication method from the platform or client. 88*a26f1301SXin Li enum AuthType { 89*a26f1301SXin Li AUTH_TYPE_UNSPECIFIED = 0; 90*a26f1301SXin Li AUTH_GAIA = 1; 91*a26f1301SXin Li AUTH_DEVICE_ATTESTATION = 2; 92*a26f1301SXin Li } 93*a26f1301SXin Li AuthType auth_type = 1; 94*a26f1301SXin Li // Currently, only Android clients need to send metadata for authentication. 95*a26f1301SXin Li oneof client { 96*a26f1301SXin Li AndroidRequestMetadata android_request_metadata = 2; 97*a26f1301SXin Li } 98*a26f1301SXin Li} 99*a26f1301SXin Li 100*a26f1301SXin Lienum AttestationScheme { 101*a26f1301SXin Li SCHEME_UNSPECIFIED = 0; 102*a26f1301SXin Li SCHEME_X509_CERTIFICATE_CHAIN = 1; 103*a26f1301SXin Li} 104*a26f1301SXin Li 105*a26f1301SXin Li// Authentication for Android devices, an alternative to Gaia. 106*a26f1301SXin Limessage AndroidRequestMetadata { 107*a26f1301SXin Li // Id of the client owning the device with the given attestation. 108*a26f1301SXin Li bytes client_id = 1; 109*a26f1301SXin Li // Android device attestation. 110*a26f1301SXin Li bytes attestation = 2; 111*a26f1301SXin Li AttestationScheme attestation_scheme = 3; 112*a26f1301SXin Li} 113*a26f1301SXin Li 114*a26f1301SXin Li// Client registration request. 115*a26f1301SXin Limessage RegisterClientRequest { 116*a26f1301SXin Li reserved 3, 4; 117*a26f1301SXin Li ClientPublicParameters client_public_params = 1; 118*a26f1301SXin Li string server_params_version = 2; 119*a26f1301SXin Li RequestMetadata request_metadata = 5; 120*a26f1301SXin Li} 121*a26f1301SXin Li 122*a26f1301SXin Li// Client registration response. 123*a26f1301SXin Limessage RegisterClientResponse { 124*a26f1301SXin Li // The name given to the client parameters, to be used for all subsequent 125*a26f1301SXin Li // token requests. 126*a26f1301SXin Li string client_params_version = 1; 127*a26f1301SXin Li // The time when tokens can be issued and redeemed for these parameters. 128*a26f1301SXin Li Timestamp client_params_expiry = 2; 129*a26f1301SXin Li // The time after which the client needs to reregister params. 130*a26f1301SXin Li Timestamp client_reregister_expiry = 3; 131*a26f1301SXin Li} 132*a26f1301SXin Li 133*a26f1301SXin Limessage GetKeyAttestationChallengeResponse { 134*a26f1301SXin Li // Transparently passed KA Challenge from KAVS 135*a26f1301SXin Li bytes attestation_challenge = 1; 136*a26f1301SXin Li // Timestamp of challenge expiration; given and managed by KAVS. 137*a26f1301SXin Li Timestamp expiry = 2; 138*a26f1301SXin Li} 139*a26f1301SXin Li 140*a26f1301SXin Li// Request to get tokens. 141*a26f1301SXin Limessage GetTokensRequest { 142*a26f1301SXin Li reserved 2, 5, 6; 143*a26f1301SXin Li 144*a26f1301SXin Li string client_params_version = 1; 145*a26f1301SXin Li TokensRequest tokens_request = 3; 146*a26f1301SXin Li 147*a26f1301SXin Li // Client fingerprints are cryptographic objects that allow the server to 148*a26f1301SXin Li // check whether the messages underlying tokens_request are different from 149*a26f1301SXin Li // all previous requests from this client with these parameters. 150*a26f1301SXin Li repeated bytes client_fingerprints_bytes = 4; 151*a26f1301SXin Li 152*a26f1301SXin Li RequestMetadata request_metadata = 7; 153*a26f1301SXin Li} 154*a26f1301SXin Li 155*a26f1301SXin Li// Response containing tokens. 156*a26f1301SXin Limessage GetTokensResponse { 157*a26f1301SXin Li TokensResponse tokens_response = 1; 158*a26f1301SXin Li // The time when tokens extracted from this response can be redeemed. 159*a26f1301SXin Li Timestamp tokens_expiry = 3; 160*a26f1301SXin Li} 161*a26f1301SXin Li 162*a26f1301SXin Li// Redeem token request. 163*a26f1301SXin Limessage RedeemTokenRequest { 164*a26f1301SXin Li reserved 3; 165*a26f1301SXin Li // The token to be redeemed. 166*a26f1301SXin Li Token token = 1; 167*a26f1301SXin Li // The server params version associated with this token. 168*a26f1301SXin Li string server_params_version = 2; 169*a26f1301SXin Li // The message signed by this token. 170*a26f1301SXin Li bytes token_message_bytes = 4; 171*a26f1301SXin Li} 172*a26f1301SXin Li 173*a26f1301SXin Li// Redeem token response. 174*a26f1301SXin Limessage RedeemTokenResponse {} 175*a26f1301SXin Li 176*a26f1301SXin Limessage JoinSetRequest { 177*a26f1301SXin Li // The name of the set to join in types/{type}/sets/{set} format. 178*a26f1301SXin Li // The type will have a maximum of 8 characters. 179*a26f1301SXin Li // The set identifier will have a maximum of 64 characters. 180*a26f1301SXin Li string name = 1; 181*a26f1301SXin Li 182*a26f1301SXin Li // The shortened (j-bit) client identifier. 183*a26f1301SXin Li uint32 short_client_identifier = 4; 184*a26f1301SXin Li 185*a26f1301SXin Li reserved 2, 3; 186*a26f1301SXin Li} 187