// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. syntax = "proto3"; package nearby.sharing.proto; import "sharing/proto/timestamp.proto"; option optimize_for = LITE_RUNTIME; // A SharedCertificate contains a secret key used when recognizing another // user's BLE advertisement and a public key used when establishing an encrypted // connection. // // How a Certificate is distributed is determined by who is on a user's contact // list. For example, if Will adds Ryan to his contact list, Ryan will have a // ShareTarget with Will's Certificate attached to it. // NextId=11 message PublicCertificate { // The secret (symmetric) identifier used when identifying the ShareTarget's // BLE advertisement. bytes secret_id = 1; // The secret (symmetric) key is used to decrypt the name field of the // ShareTarget's BLE advertisement. bytes secret_key = 2; // The public key is used to create a secure connection with the ShareTarget. bytes public_key = 3; // The time that certificate validity begins. Timestamp start_time = 4; // The time that certificate validity ends. Timestamp end_time = 5; // Indicates if this public certificate is only for selected contacts. bool for_selected_contacts = 6 [deprecated = true]; // This aes key is uploaded from device to server, but not returned to device. // It is only public to the server, for encrypting personal info metadata. bytes metadata_encryption_key = 7; // The encrypted metadata in bytes, contains personal information of the // device/user who created this certificate. Needs to be decrypted into bytes, // and converted back to EncryptedMetadata object to access fields. // Definition of this object see: // location/nearby/sharing/proto/contact_certificates.proto bytes encrypted_metadata_bytes = 8; // The tag for verifying metadata_encryption_key. bytes metadata_encryption_key_tag = 9; // Indicates if this public certificate corresponds to a device owned by the // current user. bool for_self_share = 10; } // A member of a contact list. This is not inlined on the recommendation of // http://go/apidosdonts##19-make-repeated-fields-messages-not-scalar-types // NextId=4 message Contact { // NextId=4 message Identifier { oneof identifier { string obfuscated_gaia = 1; string phone_number = 2; string account_name = 3; } } // Required. The identifier of a contact can be an obfuscated gaia id, a phone // number, or an email account name. Identifier identifier = 1; // Indicates if this contact is a selected contact. // This field is deprecated, but must still be set to true until the server // side is fixed. bool is_selected = 2 [deprecated = true]; // Indicates if this contact is ourselves. bool is_self = 3; } // A contact record from People backend. // NextId=7 message ContactRecord { // The type of the ContactRecord. enum Type { // The source of the contact is unknown. UNKNOWN = 0; // The source of the contact is from google (i.e. google.com/contacts). GOOGLE_CONTACT = 1; // The source of the contact is from a device. DEVICE_CONTACT = 2; } // The stable id of this contact record. string id = 1; // The contact record's name. string person_name = 2; // The URL of an image displayed to the user when selecting a share // target. string image_url = 3; // A list of phone numbers and emails under this contact record. repeated Contact.Identifier identifiers = 4; // The type of the ContactRecord. Type type = 5; // True if the contact record is WPS reachable. bool is_reachable = 6; } // A ShareTarget is a potential destination of a share. // NextId=2 message ShareTarget { // Optional. Contains the keys required to identify and connect to this // target. repeated PublicCertificate public_certificates = 1; } // Consists of editable data inside of a device. // NextId=5 message Device { // Required. The resource name of this contact Device. This is of the format // 'users/*/devices/*'. The special prefix 'users/me' uses the // identity of the requester. string name = 1; // The device name to show members of this contact. Ex: "Joe's Pixel". // // NOTE: Do not use on Chrome. This appears to be an artifact of the old // Nearby Share model, and could be a privacy risk that we want to avoid. // The display name is instead included in the certificate encrypted metadata. string display_name = 2; // Users that this user has added to indicate that they may see this // user as a ShareTarget when this user is nearby. repeated Contact contacts = 3; // The public certificates generated and uploaded from local device, to be // shared with contacts. repeated PublicCertificate public_certificates = 4; }