mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Begin copying sharing to github
- Start with proto dir PiperOrigin-RevId: 565712295
This commit is contained in:
committed by
Copybara-Service
parent
091b4ebfa5
commit
c7b740f0c4
@@ -37,6 +37,8 @@ jobs:
|
||||
run: CC=clang CXX=clang++ bazel build --check_visibility=false //connections:core --spawn_strategy=standalone
|
||||
- name: Build Presence
|
||||
run: CC=clang CXX=clang++ bazel build --check_visibility=false //presence --spawn_strategy=standalone
|
||||
- name: Build Sharing
|
||||
run: CC=clang CXX=clang++ bazel build --check_visibility=false //sharing/proto:all --spawn_strategy=standalone
|
||||
|
||||
build-rust-linux:
|
||||
name: Build Rust on Linux
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_proto_library")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
proto_library(
|
||||
name = "share_proto",
|
||||
srcs = [
|
||||
"certificate_rpc.proto",
|
||||
"contact_rpc.proto",
|
||||
"device_rpc.proto",
|
||||
"encrypted_metadata.proto",
|
||||
"enums.proto",
|
||||
"field_mask.proto",
|
||||
"rpc_resources.proto",
|
||||
"settings_observer_data.proto",
|
||||
"timestamp.proto",
|
||||
"wire_format.proto",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//proto:sharing_enums_proto",
|
||||
],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "enums_proto",
|
||||
srcs = ["enums.proto"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
name = "share_cc_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [":share_proto"],
|
||||
)
|
||||
@@ -0,0 +1,53 @@
|
||||
// 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/rpc_resources.proto";
|
||||
|
||||
option optimize_for = LITE_RUNTIME;
|
||||
|
||||
// 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 requesters 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;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// 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/rpc_resources.proto";
|
||||
|
||||
option optimize_for = LITE_RUNTIME;
|
||||
|
||||
// Request to list ContactRecord of a user.
|
||||
message ListContactPeopleRequest {
|
||||
// Optional limit on the number of ContactRecord in
|
||||
// [ListContactPeopleResponse.contact_records]. Defaults to 500 if not set.
|
||||
int32 page_size = 1;
|
||||
|
||||
// Optional pagination token, returned earlier via
|
||||
// [ListContactPeopleResponse.next_page_token]
|
||||
string page_token = 2;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// 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/field_mask.proto";
|
||||
import "sharing/proto/rpc_resources.proto";
|
||||
|
||||
option optimize_for = LITE_RUNTIME;
|
||||
|
||||
// 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;
|
||||
|
||||
// Optional. A hash like value to determine if the profile image has changed
|
||||
// or not. Note, the image_url can change for the same image.
|
||||
string image_token = 4;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
// 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 = "proto2";
|
||||
|
||||
package nearby.sharing.proto;
|
||||
|
||||
option optimize_for = LITE_RUNTIME;
|
||||
|
||||
// LINT.IfChange
|
||||
message EncryptedMetadata {
|
||||
// The name of the local device when certificate is created.
|
||||
optional string device_name = 1;
|
||||
|
||||
// The name of the user whose device created the certificate.
|
||||
optional string full_name = 2;
|
||||
|
||||
// The icon url of the user whose device created the certificate.
|
||||
optional string icon_url = 3;
|
||||
|
||||
// The Bluetooth MAC address of the device which created the certificate.
|
||||
optional bytes bluetooth_mac_address = 4;
|
||||
|
||||
// The obfuscated Gaia ID of the account which created the certificate.
|
||||
optional string obfuscated_gaia_id = 5;
|
||||
|
||||
// The name of the account which created the certificate.
|
||||
optional string account_name = 6;
|
||||
|
||||
// The device's model name
|
||||
optional string model_name = 7;
|
||||
|
||||
// The vendor ID of the local device.
|
||||
optional int32 vendor_id = 8;
|
||||
}
|
||||
// LINT.ThenChange(//depot/google3/location/nearby/sharing/proto/contact_certificates.proto)
|
||||
@@ -0,0 +1,61 @@
|
||||
// Copyright 2022 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;
|
||||
|
||||
option optimize_for = LITE_RUNTIME;
|
||||
|
||||
// Represents the Fast Initiation Notification feature state. This feature
|
||||
// shows a notification when a nearby device is trying to share. It can be
|
||||
// enabled/disabled independently from the Nearby Share feature.
|
||||
enum FastInitiationNotificationState {
|
||||
UNKNOWN_FAST_INIT = 0;
|
||||
ENABLED_FAST_INIT = 1;
|
||||
// User manually disabled the Fast Initiation Notification feature. If
|
||||
// Nearby Share feature is toggled the notification feature will remain
|
||||
// disabled.
|
||||
DISABLED_BY_USER_FAST_INIT = 2;
|
||||
// User turned off Nearby Share which disables the Fast Initiation
|
||||
// Notification feature. If Nearby Share is enabled while Fast Initiation
|
||||
// Notification is in this state then notifications will be re-enabled.
|
||||
DISABLED_BY_FEATURE_FAST_INIT = 3;
|
||||
}
|
||||
|
||||
enum DataUsage {
|
||||
UNKNOWN_DATA_USAGE = 0;
|
||||
// User is never willing to use the Internet
|
||||
OFFLINE_DATA_USAGE = 1;
|
||||
// User is always willing to use the Internet
|
||||
ONLINE_DATA_USAGE = 2;
|
||||
// User is willing to use the Internet on an un-metered connection.
|
||||
// NOTE: This matches Android Nearby Share's naming for now.
|
||||
WIFI_ONLY_DATA_USAGE = 3;
|
||||
}
|
||||
|
||||
enum DeviceVisibility {
|
||||
DEVICE_VISIBILITY_UNSPECIFIED = 0;
|
||||
// The user is visible to no one.
|
||||
DEVICE_VISIBILITY_HIDDEN = 1;
|
||||
// The user is visible to devices signed in with the same account.
|
||||
DEVICE_VISIBILITY_SELF_SHARE = 2;
|
||||
// The user is visible to all contacts.
|
||||
DEVICE_VISIBILITY_ALL_CONTACTS = 3;
|
||||
// The user is visible to everyone.
|
||||
DEVICE_VISIBILITY_EVERYONE = 4;
|
||||
// TODO(b/251499089): Combine kAllContacts and kSelectedContacts to kContacts
|
||||
// The user is only visible to selected contacts.
|
||||
DEVICE_VISIBILITY_SELECTED_CONTACTS = 5;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// 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;
|
||||
|
||||
option optimize_for = LITE_RUNTIME;
|
||||
|
||||
message FieldMask {
|
||||
// The set of field mask paths.
|
||||
repeated string paths = 1;
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
// 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;
|
||||
|
||||
// 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.
|
||||
bool is_selected = 2;
|
||||
|
||||
// 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;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright 2023 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;
|
||||
|
||||
option optimize_for = LITE_RUNTIME;
|
||||
|
||||
// LINT.IfChange(TaggedUnion)
|
||||
// Tag and Data define a "variant" type, aka tagged union.
|
||||
// https://en.wikipedia.org/wiki/Tagged_union
|
||||
enum Tag {
|
||||
TAG_NULL = 0;
|
||||
TAG_BOOL = 1;
|
||||
TAG_INT64 = 2;
|
||||
TAG_STRING = 3;
|
||||
TAG_STRING_ARRAY = 4;
|
||||
}
|
||||
|
||||
message Data {
|
||||
Tag tag = 1;
|
||||
// Not using `oneof` because `repeated` is not allowed in `oneof`
|
||||
optional bool as_bool = 2;
|
||||
optional int64 as_int64 = 3;
|
||||
optional string as_string = 4;
|
||||
repeated string as_string_array = 5;
|
||||
}
|
||||
// LINT.ThenChange(
|
||||
// //depot/google3/third_party/nearby/sharing/nearby_sharing_settings.h:TaggedUnion
|
||||
// )
|
||||
@@ -0,0 +1,32 @@
|
||||
// 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;
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -0,0 +1,339 @@
|
||||
syntax = "proto2";
|
||||
|
||||
package nearby.sharing.service.proto;
|
||||
|
||||
import "proto/sharing_enums.proto";
|
||||
|
||||
option java_package = "com.google.android.gms.nearby.sharing";
|
||||
option java_outer_classname = "Protocol";
|
||||
option objc_class_prefix = "GNSHP";
|
||||
option optimize_for = LITE_RUNTIME;
|
||||
|
||||
// File metadata. Does not include the actual bytes of the file.
|
||||
// NEXT_ID=6
|
||||
message FileMetadata {
|
||||
enum Type {
|
||||
UNKNOWN = 0;
|
||||
IMAGE = 1;
|
||||
VIDEO = 2;
|
||||
ANDROID_APP = 3;
|
||||
AUDIO = 4;
|
||||
DOCUMENT = 5;
|
||||
}
|
||||
|
||||
// The human readable name of this file (eg. 'Cookbook.pdf').
|
||||
optional string name = 1;
|
||||
|
||||
// The type of file (eg. 'IMAGE' from 'dog.jpg'). Specifying a type helps
|
||||
// provide a richer experience on the receiving side.
|
||||
optional Type type = 2 [default = UNKNOWN];
|
||||
|
||||
// The FILE payload id that will be sent as a follow up containing the actual
|
||||
// bytes of the file.
|
||||
optional int64 payload_id = 3;
|
||||
|
||||
// The total size of the file.
|
||||
optional int64 size = 4;
|
||||
|
||||
// The mimeType of file (eg. 'image/jpeg' from 'dog.jpg'). Specifying a
|
||||
// mimeType helps provide a richer experience on receiving side.
|
||||
optional string mime_type = 5 [default = "application/octet-stream"];
|
||||
|
||||
// A uuid for the attachment. Should be unique across all attachments.
|
||||
optional int64 id = 6;
|
||||
|
||||
// The parent folder.
|
||||
optional string parent_folder = 7;
|
||||
|
||||
// A stable identifier for the attachment. Used for receiver to identify same
|
||||
// attachment from different transfers.
|
||||
optional int64 attachment_hash = 8;
|
||||
}
|
||||
|
||||
// NEXT_ID=5
|
||||
message TextMetadata {
|
||||
enum Type {
|
||||
UNKNOWN = 0;
|
||||
TEXT = 1;
|
||||
// Open with browsers.
|
||||
URL = 2;
|
||||
// Open with map apps.
|
||||
ADDRESS = 3;
|
||||
// Dial.
|
||||
PHONE_NUMBER = 4;
|
||||
}
|
||||
|
||||
// The title of the text content.
|
||||
optional string text_title = 2;
|
||||
|
||||
// The type of text (phone number, url, address, or plain text).
|
||||
optional Type type = 3 [default = UNKNOWN];
|
||||
|
||||
// The BYTE payload id that will be sent as a follow up containing the actual
|
||||
// bytes of the text.
|
||||
optional int64 payload_id = 4;
|
||||
|
||||
// The size of the text content.
|
||||
optional int64 size = 5;
|
||||
|
||||
// A uuid for the attachment. Should be unique across all attachments.
|
||||
optional int64 id = 6;
|
||||
}
|
||||
|
||||
// NEXT_ID=5
|
||||
message WifiCredentialsMetadata {
|
||||
enum SecurityType {
|
||||
UNKNOWN_SECURITY_TYPE = 0;
|
||||
OPEN = 1;
|
||||
WPA_PSK = 2;
|
||||
WEP = 3;
|
||||
SAE = 4;
|
||||
}
|
||||
|
||||
// The Wifi network name. This will be sent in introduction.
|
||||
optional string ssid = 2;
|
||||
|
||||
// The security type of network (OPEN, WPA_PSK, WEP).
|
||||
optional SecurityType security_type = 3 [default = UNKNOWN_SECURITY_TYPE];
|
||||
|
||||
// The BYTE payload id that will be sent as a follow up containing the
|
||||
// password.
|
||||
optional int64 payload_id = 4;
|
||||
|
||||
// A uuid for the attachment. Should be unique across all attachments.
|
||||
optional int64 id = 5;
|
||||
}
|
||||
|
||||
// NEXT_ID=8
|
||||
message AppMetadata {
|
||||
// The app name. This will be sent in introduction.
|
||||
optional string app_name = 1;
|
||||
|
||||
// The size of the all split of apks.
|
||||
optional int64 size = 2;
|
||||
|
||||
// The File payload id that will be sent as a follow up containing the
|
||||
// apk paths.
|
||||
repeated int64 payload_id = 3 [packed = true];
|
||||
|
||||
// A uuid for the attachment. Should be unique across all attachments.
|
||||
optional int64 id = 4;
|
||||
|
||||
// The name of apk file. This will be sent in introduction.
|
||||
repeated string file_name = 5;
|
||||
|
||||
// The size of apk file. This will be sent in introduction.
|
||||
repeated int64 file_size = 6 [packed = true];
|
||||
|
||||
// The package name. This will be sent in introduction.
|
||||
optional string package_name = 7;
|
||||
}
|
||||
|
||||
// A frame used when sending messages over the wire.
|
||||
// NEXT_ID=3
|
||||
message Frame {
|
||||
enum Version {
|
||||
UNKNOWN_VERSION = 0;
|
||||
V1 = 1;
|
||||
}
|
||||
optional Version version = 1;
|
||||
|
||||
// Right now there's only 1 version, but if there are more, exactly one of
|
||||
// the following fields will be set.
|
||||
optional V1Frame v1 = 2;
|
||||
}
|
||||
|
||||
// NEXT_ID=8
|
||||
message V1Frame {
|
||||
enum FrameType {
|
||||
UNKNOWN_FRAME_TYPE = 0;
|
||||
INTRODUCTION = 1;
|
||||
RESPONSE = 2;
|
||||
PAIRED_KEY_ENCRYPTION = 3;
|
||||
PAIRED_KEY_RESULT = 4;
|
||||
CERTIFICATE_INFO = 5;
|
||||
CANCEL = 6;
|
||||
PROGRESS_UPDATE = 7;
|
||||
}
|
||||
|
||||
optional FrameType type = 1;
|
||||
|
||||
// At most one of the following fields will be set.
|
||||
optional IntroductionFrame introduction = 2;
|
||||
optional ConnectionResponseFrame connection_response = 3;
|
||||
optional PairedKeyEncryptionFrame paired_key_encryption = 4;
|
||||
optional PairedKeyResultFrame paired_key_result = 5;
|
||||
optional CertificateInfoFrame certificate_info = 6;
|
||||
optional ProgressUpdateFrame progress_update = 7;
|
||||
}
|
||||
|
||||
// An introduction packet sent by the sending side. Contains a list of files
|
||||
// they'd like to share.
|
||||
// NEXT_ID=7
|
||||
message IntroductionFrame {
|
||||
repeated FileMetadata file_metadata = 1;
|
||||
repeated TextMetadata text_metadata = 2;
|
||||
// The required app package to open the content. May be null.
|
||||
optional string required_package = 3;
|
||||
repeated WifiCredentialsMetadata wifi_credentials_metadata = 4;
|
||||
repeated AppMetadata app_metadata = 5;
|
||||
optional bool start_transfer = 6;
|
||||
}
|
||||
|
||||
// A progress update packet sent by the sending side. Contains transfer progress
|
||||
// value. NEXT_ID=3
|
||||
message ProgressUpdateFrame {
|
||||
optional float progress = 1;
|
||||
|
||||
// True, if the receiver should start bandwidth upgrade and receiving the
|
||||
// payloads.
|
||||
optional bool start_transfer = 2;
|
||||
}
|
||||
|
||||
// A response packet sent by the receiving side. Accepts or rejects the list of
|
||||
// files.
|
||||
// NEXT_ID=3
|
||||
message ConnectionResponseFrame {
|
||||
enum Status {
|
||||
UNKNOWN = 0;
|
||||
ACCEPT = 1;
|
||||
REJECT = 2;
|
||||
NOT_ENOUGH_SPACE = 3;
|
||||
UNSUPPORTED_ATTACHMENT_TYPE = 4;
|
||||
TIMED_OUT = 5;
|
||||
}
|
||||
|
||||
// The receiving side's response.
|
||||
optional Status status = 1;
|
||||
|
||||
// Key is attachment hash, value is the details of attachment.
|
||||
map<int64, AttachmentDetails> attachment_details = 2;
|
||||
}
|
||||
|
||||
// Attachment details that sent in ConnectionResponseFrame.
|
||||
message AttachmentDetails {
|
||||
// LINT.IfChange
|
||||
enum Type {
|
||||
UNKNOWN = 0;
|
||||
// Represents FileAttachment.
|
||||
FILE = 1;
|
||||
// Represents TextAttachment.
|
||||
TEXT = 2;
|
||||
// Represents WifiCredentialsAttachment.
|
||||
WIFI_CREDENTIALS = 3;
|
||||
// Represents AppAttachment.
|
||||
APP = 4;
|
||||
}
|
||||
// LINT.ThenChange(//depot/google3/java/com/google/android/gmscore/integ/client/nearby/src/com/google/android/gms/nearby/sharing/Attachment.java)
|
||||
|
||||
// The attachment family type.
|
||||
optional Type type = 1;
|
||||
|
||||
// This field is only for FILE type.
|
||||
optional FileAttachmentDetails file_attachment_details = 2;
|
||||
}
|
||||
|
||||
// File attachment details included in ConnectionResponseFrame.
|
||||
message FileAttachmentDetails {
|
||||
// Existing local file size on receiver side.
|
||||
optional int64 receiver_existing_file_size = 1;
|
||||
|
||||
// The key is attachment hash, a stable identifier for the attachment.
|
||||
// Value is list of payload details transferred for the attachment.
|
||||
map<int64, PayloadsDetails> attachment_hash_payloads = 2;
|
||||
}
|
||||
|
||||
message PayloadsDetails {
|
||||
// The list should be sorted by creation timestamp.
|
||||
repeated PayloadDetails payload_details = 1;
|
||||
}
|
||||
|
||||
// Metadata of a payload file created by Nearby Connections.
|
||||
message PayloadDetails {
|
||||
optional int64 id = 1;
|
||||
optional int64 creation_timestamp_millis = 2;
|
||||
optional int64 size = 3;
|
||||
}
|
||||
|
||||
// A paired key encryption packet sent between devices, contains signed data.
|
||||
// NEXT_ID=5
|
||||
message PairedKeyEncryptionFrame {
|
||||
// The encrypted data in byte array format.
|
||||
optional bytes signed_data = 1;
|
||||
|
||||
// The hash of a certificate id.
|
||||
optional bytes secret_id_hash = 2;
|
||||
|
||||
// An optional encrypted data in byte array format.
|
||||
optional bytes optional_signed_data = 3;
|
||||
|
||||
// An optional QR code handshake data in a byte array format.
|
||||
// For incoming connection contains a signature of the UKEY2
|
||||
// token, created with the sender's private key.
|
||||
// For outgoing connection contains an HKDF of the connection token and of the
|
||||
// UKEY2 token
|
||||
optional bytes qr_code_handshake_data = 4;
|
||||
}
|
||||
|
||||
// A paired key verification result packet sent between devices.
|
||||
// NEXT_ID=3
|
||||
message PairedKeyResultFrame {
|
||||
enum Status {
|
||||
UNKNOWN = 0;
|
||||
SUCCESS = 1;
|
||||
FAIL = 2;
|
||||
UNABLE = 3;
|
||||
}
|
||||
|
||||
// The verification result.
|
||||
optional Status status = 1;
|
||||
|
||||
// OS type.
|
||||
optional location.nearby.proto.sharing.OSType os_type = 2;
|
||||
}
|
||||
|
||||
// A package containing certificate info to be shared to remote device offline.
|
||||
// NEXT_ID=2
|
||||
message CertificateInfoFrame {
|
||||
// The public certificates to be shared with remote devices.
|
||||
repeated PublicCertificate public_certificate = 1;
|
||||
}
|
||||
|
||||
// A public certificate from the local device.
|
||||
// NEXT_ID=8
|
||||
message PublicCertificate {
|
||||
// The unique id of the public certificate.
|
||||
optional bytes secret_id = 1;
|
||||
|
||||
// A bytes representation of a Secret Key owned by contact, to decrypt the
|
||||
// metadata_key stored within the advertisement.
|
||||
optional bytes authenticity_key = 2;
|
||||
|
||||
// A bytes representation a public key of X509Certificate, owned by contact,
|
||||
// to decrypt encrypted UKEY2 (from Nearby Connections API) as a hand shake in
|
||||
// contact verification phase.
|
||||
optional bytes public_key = 3;
|
||||
|
||||
// The time in millis from epoch when this certificate becomes effective.
|
||||
optional int64 start_time = 4;
|
||||
|
||||
// The time in millis from epoch when this certificate expires.
|
||||
optional int64 end_time = 5;
|
||||
|
||||
// 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.
|
||||
optional bytes encrypted_metadata_bytes = 6;
|
||||
|
||||
// The tag for verifying metadata_encryption_key.
|
||||
optional bytes metadata_encryption_key_tag = 7;
|
||||
}
|
||||
|
||||
// NEXT_ID=3
|
||||
message WifiCredentials {
|
||||
// Wi-Fi password.
|
||||
optional string password = 1;
|
||||
// True if the network is a hidden network that is not broadcasting its SSID.
|
||||
// Default is false.
|
||||
optional bool hidden_ssid = 2 [default = false];
|
||||
}
|
||||
Reference in New Issue
Block a user