Skip to content

Commit

Permalink
move identity protos.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 704428031
  • Loading branch information
suetfei authored and copybara-github committed Dec 10, 2024
1 parent 2352d73 commit 8fead5c
Show file tree
Hide file tree
Showing 12 changed files with 245 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Build Presence
run: CC=clang-15 CXX=clang-15++ bazel build --copt='-DGITHUB_BUILD' //presence
- name: Build Sharing
run: CC=clang-15 CXX=clang-15++ bazel build --verbose_failures --copt='-DGITHUB_BUILD' //sharing/proto/... //sharing/analytics
run: CC=clang-15 CXX=clang-15++ bazel build --verbose_failures --copt='-DGITHUB_BUILD' //sharing:nearby_sharing_service //sharing/certificates //sharing/contacts //sharing/local_device_data //sharing/proto/... //sharing/internal/public:nearby_context //sharing/common:all //sharing/scheduling //sharing/fast_initiation:nearby_fast_initiation //sharing/analytics

build-rust-linux:
name: Build Rust on Linux
Expand Down
44 changes: 44 additions & 0 deletions proto/identity/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright 2020 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.

load("@com_google_protobuf//bazel:cc_proto_library.bzl", "cc_proto_library")
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")

package(default_visibility = ["//visibility:public"])

proto_library(
name = "resources_proto",
srcs = ["resources.proto"],
deps = [
"//sharing/proto:share_proto",
],
)

cc_proto_library(
name = "resources_cc_proto",
deps = [":resources_proto"],
)

proto_library(
name = "rpcs_proto",
srcs = ["rpcs.proto"],
deps = [
":resources_proto",
],
)

cc_proto_library(
name = "rpcs_cc_proto",
deps = [":rpcs_proto"],
)
110 changes: 110 additions & 0 deletions proto/identity/resources.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
// 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.

// DO NOT EDIT DIRECTLY.
// This file is a third_party mirror of
// google/nearby/identity/v1/resources.proto.

syntax = "proto3";

package google.nearby.identity.v1;

import "sharing/proto/timestamp.proto";

option java_package = "com.google.nearby.identity.v1";
option java_outer_classname = "ResourcesProto";
option java_multiple_files = true;
option optimize_for = LITE_RUNTIME;

// This message represents an SharedCredential generated by Google Nearby client
// for a device participating in the Nearby Ecosystem. The "data" field in this
// proto is transparent to the Nearby SDK clients as well as the Nearby backend
// service.
message SharedCredential {
// Data type of the "data" field.
enum DataType {
// Undefined or unset.
DATA_TYPE_UNSPECIFIED = 0;
// For Nearby Share.
DATA_TYPE_PUBLIC_CERTIFICATE = 1;
// For Nearby Presence.
DATA_TYPE_SHARED_CREDENTIAL = 2;
}

// The unique identifier for the SharedCredential.
int64 id = 1;

// Set it to DATE_TYPE_NEARBY_PUBLIC_CERTIFICATE for Nearby Share and
// DATA_TYPE_NEARBY_SHARED_CREDENTIAL for Nearby Presence.
DataType data_type = 2;

// Serialized proto based on data_type that indicates the proto type, e.g.
// DATA_TYPE_PUBLIC_CERTIFICATE for proto message PublicCertificate. The
// server will store and distribute them to contacts and requesters, but it
// doesn't interprete the data itself.
bytes data = 3;

// The expiration timestamp. The SharedCredential is excluded from the
// QuerySharedCredentials RPC response if it is expired.
.nearby.sharing.proto.Timestamp expiration_time = 5;
}

// The SharedCredentials for a specific visibility.
message PerVisibilitySharedCredentials {
// The visility of the SharedCredential.
enum Visibility {
// Undefined or unset.
VISIBILITY_UNSPECIFIED = 0;
// Visible to requester's devices only
VISIBILITY_SELF = 1;
// Visible to requester's contacts. This also implies VISIBILITY_SELF.
VISIBILITY_CONTACTS = 2;
}
// The visibility of the SharedCredentials.
Visibility visibility = 1;
// All the SharedCredentials for the visibility.
repeated SharedCredential shared_credentials = 2;
}

// Device represents the device meta information and its SharedCredentials
// for discovery.
message Device {
// The device id, unique per gaia user.
string name = 1;
// The display_name.
string display_name = 2;

// What contact and how they should be used in distribute the
// SharedCredentials.
enum Contact {
// Unknown or unset. It will be treated as an error.
CONTACT_UNSPECIFIED = 0;
// For the requester only.
CONTACT_SELF = 1;
// The Google contact, the best effort for the freshness.
CONTACT_GOOGLE_CONTACT = 2;
// The latest Google contacts in the Google backend.
CONTACT_GOOGLE_CONTACT_LATEST = 3;
}
// For CONTACT_GOOGLE_CONTACT/CONTACT_GOOGLE_CONTACT_LATEST, the service will
// allow requester's Google contacts to download (Query) SharedCredentials
// from the Nearby service.
Contact contact = 3;

// All the SharedCredentials including VISIBILITY_SELF and VISIBILITY_CONTACT.
// When per_visibility_shared_credentials for VISIBILITY_CONTACT and the
// contact is not CONTACT_SELF, the server will make those to be accessible to
// (downloaded by) the requester's contacts.
repeated PerVisibilitySharedCredentials per_visibility_shared_credentials = 4;
}
72 changes: 72 additions & 0 deletions proto/identity/rpcs.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// 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.

// DO NOT EDIT DIRECTLY.
// This file is a third_party mirror of
// google/nearby/identity/v1/rpcs.proto.

syntax = "proto3";

package google.nearby.identity.v1;

import "proto/identity/resources.proto";

option java_package = "com.google.nearby.identity.v1";
option java_outer_classname = "RpcsProto";
option java_multiple_files = true;
option optimize_for = LITE_RUNTIME;

// Publish the Device's SharedCredentials, its meta-info and contacts info
// that the backend uses to distribute the SharedCredentials.
message PublishDeviceRequest {
// The Device with both metadata and SharedCredentials.
Device device = 1;
}
// The response message for PublishDevic RPC.
message PublishDeviceResponse {
// The enum used to indicate the contact update result.
enum ContactUpdate {
// The contact is not updated.
CONTACT_UPDATE_UNSPECIFIED = 0;
// The contact is updated.
CONTACT_UPDATE_ADDED = 1;
// The contact is removed.
CONTACT_UPDATE_REMOVED = 2;
}
// The contact update result.
repeated ContactUpdate contact_updates = 1;
}

// Query all the SharedCredentials.
message QuerySharedCredentialsRequest {
// The Device to query with format: devices/{device}. The device is the
// requester's current device-id. The device-id is used to filter out the
// SharedCredentials from the current device as the device has all of them.
string name = 1;
// the page size for the streaming request.
int32 page_size = 2;
// the continue token.
string page_token = 3;
}

// The message containing all the SharedCredentials the requester can access,
// i.e. those devices using the SharedCredentials in advertising are visible to
// the requester.
message QuerySharedCredentialsResponse {
// All the unexpired SharedCredentials that other devices has shared with the
// requester
repeated SharedCredential shared_credentials = 1;
// next page token.
string next_page_token = 2;
}
8 changes: 4 additions & 4 deletions sharing/certificates/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ cc_library(
"//internal/flags:nearby_flags",
"//internal/platform:types",
"//internal/platform/implementation:account_manager",
"//proto/identity/v1:resources_cc_proto",
"//proto/identity/v1:rpcs_cc_proto",
"//proto/identity:resources_cc_proto",
"//proto/identity:rpcs_cc_proto",
"//sharing/common",
"//sharing/common:enum",
"//sharing/contacts",
Expand Down Expand Up @@ -122,8 +122,8 @@ cc_test(
"//internal/platform/implementation:account_manager",
"//internal/platform/implementation/g3", # fixdeps: keep
"//internal/test",
"//proto/identity/v1:resources_cc_proto",
"//proto/identity/v1:rpcs_cc_proto",
"//proto/identity:resources_cc_proto",
"//proto/identity:rpcs_cc_proto",
"//sharing/common",
"//sharing/common:enum",
"//sharing/contacts:test_support",
Expand Down
4 changes: 2 additions & 2 deletions sharing/certificates/nearby_share_certificate_manager_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
#include "absl/types/span.h"
#include "internal/flags/nearby_flags.h"
#include "internal/platform/implementation/account_manager.h"
#include "proto/identity/v1/resources.pb.h"
#include "proto/identity/v1/rpcs.pb.h"
#include "proto/identity/resources.pb.h"
#include "proto/identity/rpcs.pb.h"
#include "sharing/certificates/common.h"
#include "sharing/certificates/constants.h"
#include "sharing/certificates/nearby_share_certificate_manager.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
#include "internal/flags/nearby_flags.h"
#include "internal/platform/implementation/account_manager.h"
#include "internal/test/fake_account_manager.h"
#include "proto/identity/v1/resources.pb.h"
#include "proto/identity/v1/rpcs.pb.h"
#include "proto/identity/resources.pb.h"
#include "proto/identity/rpcs.pb.h"
#include "sharing/certificates/constants.h"
#include "sharing/certificates/fake_nearby_share_certificate_storage.h"
#include "sharing/certificates/nearby_share_certificate_manager.h"
Expand Down
2 changes: 1 addition & 1 deletion sharing/internal/api/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ cc_library(
deps = [
"//internal/platform:types",
"//internal/platform/implementation:account_manager",
"//proto/identity/v1:rpcs_cc_proto",
"//proto/identity:rpcs_cc_proto",
"//sharing/analytics",
"//sharing/proto:share_cc_proto",
"@com_google_absl//absl/functional:any_invocable",
Expand Down
2 changes: 1 addition & 1 deletion sharing/internal/api/sharing_rpc_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include "absl/functional/any_invocable.h"
#include "absl/status/statusor.h"
#include "proto/identity/v1/rpcs.pb.h"
#include "proto/identity/rpcs.pb.h"
#include "sharing/internal/api/sharing_rpc_notifier.h"
#include "sharing/proto/certificate_rpc.pb.h"
#include "sharing/proto/contact_rpc.pb.h"
Expand Down
8 changes: 4 additions & 4 deletions sharing/local_device_data/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ cc_library(
"//internal/platform:types",
"//internal/platform/implementation:account_manager",
"//internal/platform/implementation:types",
"//proto/identity/v1:resources_cc_proto",
"//proto/identity/v1:rpcs_cc_proto",
"//proto/identity:resources_cc_proto",
"//proto/identity:rpcs_cc_proto",
"//sharing/common",
"//sharing/common:enum",
"//sharing/internal/api:platform",
Expand Down Expand Up @@ -80,8 +80,8 @@ cc_test(
"//internal/platform/implementation:account_manager",
"//internal/platform/implementation/g3", # fixdeps: keep
"//internal/test",
"//proto/identity/v1:resources_cc_proto",
"//proto/identity/v1:rpcs_cc_proto",
"//proto/identity:resources_cc_proto",
"//proto/identity:rpcs_cc_proto",
"//sharing/common",
"//sharing/common:enum",
"//sharing/internal/api:mock_sharing_platform",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
#include "internal/platform/device_info.h"
#include "internal/platform/implementation/account_manager.h"
#include "internal/platform/implementation/device_info.h"
#include "proto/identity/v1/resources.pb.h"
#include "proto/identity/v1/rpcs.pb.h"
#include "proto/identity/resources.pb.h"
#include "proto/identity/rpcs.pb.h"
#include "sharing/common/nearby_share_enums.h"
#include "sharing/common/nearby_share_prefs.h"
#include "sharing/internal/api/preference_manager.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
#include "internal/test/fake_account_manager.h"
#include "internal/test/fake_device_info.h"
#include "internal/test/fake_task_runner.h"
#include "proto/identity/v1/resources.pb.h"
#include "proto/identity/v1/rpcs.pb.h"
#include "proto/identity/resources.pb.h"
#include "proto/identity/rpcs.pb.h"
#include "sharing/common/nearby_share_enums.h"
#include "sharing/common/nearby_share_prefs.h"
#include "sharing/internal/api/fake_nearby_share_client.h"
Expand Down

0 comments on commit 8fead5c

Please sign in to comment.