Commit df534697 authored by Curt Clemens's avatar Curt Clemens Committed by Commit Bot

[NearbySharingHTTP] Add NearbyShare proto library

Based on Nearby Sharing Server protos located at
https://source.corp.google.com/piper///depot/google3/google/internal/location/nearby/sharing/v1/

Change-Id: Ia2b20570a48eb293fc4c485e97c5f0c044c9fbde
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2228987Reviewed-by: default avatarJames Vecore <vecore@google.com>
Reviewed-by: default avatarJosh Nohle <nohle@chromium.org>
Commit-Queue: Curt Clemens <cclem@google.com>
Cr-Commit-Position: refs/heads/master@{#781180}
parent 78acefc6
......@@ -3689,6 +3689,7 @@ static_library("browser") {
"//base/util/timer",
"//chrome/app/vector_icons",
"//chrome/browser/nearby_sharing/logging",
"//chrome/browser/nearby_sharing/proto",
"//chrome/browser/policy:path_parser",
"//chrome/browser/profile_resetter:profile_reset_report_proto",
"//chrome/browser/resource_coordinator:intervention_policy_database_proto",
......
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//third_party/protobuf/proto_library.gni")
proto_library("proto") {
sources = [
"certificate_rpc.proto",
"contact_rpc.proto",
"device_rpc.proto",
"field_mask.proto",
"rpc_resources.proto",
"timestamp.proto",
]
}
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Keep in sync with
// http://google3/google/internal/location/nearby/sharing/v1/rpcs/certificates.proto
// Messages not used in Chrome have been omitted. Last copied at cl/2228987.
syntax = "proto3";
package nearbyshare.proto;
option optimize_for = LITE_RUNTIME;
import "rpc_resources.proto";
// Request to list public certificate objects.
message ListPublicCertificatesRequest {
// Required. The resource name determines which public certificates to list.
// The special prefix "users/me" lists the requester's own share targets. This
// is of the format "users/*/devices/*".
string parent = 1;
// Optional limit on the number of ShareTarget objects to check for
// PublicCertificates for the response. Further PublicCertificates items may
// be obtained by including the page_token in a subsequent request. If this is
// not set or zero, a reasonable default value is used.
int32 page_size = 2;
// Optional pagination token, returned earlier via
// [ListPublicCertificatesResponse.next_page_token]
string page_token = 3;
// Optional. Represents certificates already available on local device.
repeated bytes secret_ids = 4;
}
// Response that contains the public certificates available to calling device.
message ListPublicCertificatesResponse {
// Optional. A token to retrieve the next page of results when used in
// [ListPublicCertificatesRequest].
string next_page_token = 1;
// Optional. Public certificates allowed to be accessed by the calling local
// device.
repeated PublicCertificate public_certificates = 2;
}
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Keep in sync with
// http://google3/google/internal/location/nearby/sharing/v1/rpcs/contacts.proto
// Messages not used in Chrome have been omitted. Last copied at cl/2228987.
syntax = "proto3";
package nearbyshare.proto;
option optimize_for = LITE_RUNTIME;
import "rpc_resources.proto";
// Request to get contacts reachability and recommendation for sharing.
message CheckContactsReachabilityRequest {
message ReachableContact {
string contact_id = 1;
repeated string phone_numbers = 2;
repeated string emails = 3;
}
repeated ReachableContact contacts = 1;
}
message CheckContactsReachabilityResponse {
message Result {
string contact_id = 1;
bool is_reachable = 2;
bool is_recommended = 3;
}
repeated Result results = 1;
}
// Request to list ContactRecord of a user.
message ListContactPeopleRequest {
// Required. The resource name determines which contact records to list.
// The special prefix "users/me" lists the requester's own contacts. This
// is of the format "users/*/devices/*".
string parent = 1;
// Optional limit on the number of ContactRecord in
// [ListContactPeopleResponse.contact_records]. Defaults to 2000 if not set.
int32 page_size = 2;
// Optional pagination token, returned earlier via
// [ListContactPeopleResponse.next_page_token]
string page_token = 3;
}
// Response from a ListContactPeopleRequest.
message ListContactPeopleResponse {
// The ContactRecord in this collection.
repeated ContactRecord contact_records = 1;
// Optional. A token to retrieve the next page of results when used in
// [ListContactPeopleRequest]. Empty if no page is available.
string next_page_token = 2;
}
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Keep in sync with
// http://google3/google/internal/location/nearby/sharing/v1/rpcs/devices.proto
// Messages not used in Chrome have been omitted. Last copied at cl/2228987.
syntax = "proto3";
package nearbyshare.proto;
option optimize_for = LITE_RUNTIME;
import "rpc_resources.proto";
import "field_mask.proto";
// The request used to register a [location.nearby.sharing.proto.Device]
// with the server.
message UpdateDeviceRequest {
// The [Device] to be updated.
Device device = 1;
// The FieldMask for updating specific columns in device table. For the
// 'FieldMask' definition, see
// https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
FieldMask update_mask = 2;
}
// The response for UpdateDeviceRequest.
message UpdateDeviceResponse {
// The [Device] to be returned.
Device device = 1;
// Optional. The user's name as displayed to the user when selecting a share
// target. Ex: "Will Harmon"
string person_name = 2;
// Optional. The URL of an image displayed to the user when selecting a
// share target.
string image_url = 3;
}
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Copied from
// https://cs.chromium.org/chromium/src/third_party/protobuf/src/google/protobuf/field_mask.proto?rcl=b51864c7aae4372308052b9fd5c1913ceeee3884
syntax = "proto3";
package nearbyshare.proto;
option optimize_for = LITE_RUNTIME;
message FieldMask {
// The set of field mask paths.
repeated string paths = 1;
}
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Keep in sync with
// http://google3/google/internal/location/nearby/sharing/v1/resources.proto
// Messages not used in Chrome have been omitted. Last copied at cl/2228987.
syntax = "proto3";
package nearbyshare.proto;
option optimize_for = LITE_RUNTIME;
import "timestamp.proto";
// 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=10
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;
// 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;
}
// 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=3
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.
bool is_selected = 2;
}
// A contact record from People backend.
// NextId=5
message ContactRecord {
// 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;
}
// 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"
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;
}
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Copied from
// https://cs.chromium.org/chromium/src/third_party/protobuf/src/google/protobuf/timestamp.proto?rcl=b51864c7aae4372308052b9fd5c1913ceeee3884
syntax = "proto3";
package nearbyshare.proto;
option optimize_for = LITE_RUNTIME;
message Timestamp {
// Represents seconds of UTC time since Unix epoch
// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
// 9999-12-31T23:59:59Z inclusive.
int64 seconds = 1;
// Non-negative fractions of a second at nanosecond resolution. Negative
// second values with fractions must still have non-negative nanos values
// that count forward in time. Must be from 0 to 999,999,999
// inclusive.
int32 nanos = 2;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment