diff --git a/internal/platform/BUILD b/internal/platform/BUILD index 5589512e..7e3c9be4 100644 --- a/internal/platform/BUILD +++ b/internal/platform/BUILD @@ -30,7 +30,6 @@ cc_library( "bluetooth_utils.h", "byte_array.h", "callable.h", - "credential.h", "exception.h", "feature_flags.h", "input_stream.h", diff --git a/internal/platform/implementation/BUILD b/internal/platform/implementation/BUILD index b5a0bd55..f905cb92 100644 --- a/internal/platform/implementation/BUILD +++ b/internal/platform/implementation/BUILD @@ -77,6 +77,7 @@ cc_library( "//internal/platform:base", "//internal/platform:cancellation_flag", "//internal/platform:uuid", + "//third_party/nearby/presence:credential", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/container:flat_hash_set", "@com_google_absl//absl/strings", diff --git a/internal/platform/implementation/credential_storage.h b/internal/platform/implementation/credential_storage.h index e219b4fb..47593ec7 100644 --- a/internal/platform/implementation/credential_storage.h +++ b/internal/platform/implementation/credential_storage.h @@ -20,13 +20,17 @@ #include #include -#include "internal/platform/credential.h" #include "internal/platform/exception.h" +#include "third_party/nearby/presence/credential.h" namespace location { namespace nearby { namespace api { +using ::nearby::presence::PrivateCredential; +using ::nearby::presence::PublicCredential; +using ::nearby::presence::TrustType; + enum class CredentialOperationStatus { kFailed = 0, kSucceeded = 1, diff --git a/presence/BUILD b/presence/BUILD index 94bcb31c..5e00dc25 100644 --- a/presence/BUILD +++ b/presence/BUILD @@ -137,6 +137,14 @@ cc_library( ], ) +cc_library( + name = "credential", + hdrs = ["credential.h"], + visibility = [ + "//third_party/nearby:__subpackages__", + ], +) + cc_test( name = "advertisement_factory_test", size = "small", diff --git a/internal/platform/credential.h b/presence/credential.h similarity index 94% rename from internal/platform/credential.h rename to presence/credential.h index a4d43d30..b6dabb4c 100644 --- a/internal/platform/credential.h +++ b/presence/credential.h @@ -12,15 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_CREDENTIAL_H_ -#define THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_CREDENTIAL_H_ +#ifndef THIRD_PARTY_NEARBY_PRESENCE_CREDENTIAL_H_ +#define THIRD_PARTY_NEARBY_PRESENCE_CREDENTIAL_H_ #include #include #include -namespace location { namespace nearby { +namespace presence { enum class TrustType { kUnspecified = 0, @@ -125,7 +125,7 @@ struct PublicCredential { std::vector metadata_encryption_key_tag; }; +} // namespace presence } // namespace nearby -} // namespace location -#endif // THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_CREDENTIAL_H_ +#endif // THIRD_PARTY_NEARBY_PRESENCE_CREDENTIAL_H_ diff --git a/presence/implementation/BUILD b/presence/implementation/BUILD index 5aca64aa..7e54592d 100644 --- a/presence/implementation/BUILD +++ b/presence/implementation/BUILD @@ -30,6 +30,7 @@ cc_library( deps = [ "//internal/platform:base", "//internal/platform:comm", + "//third_party/nearby/presence:credential", "//third_party/nearby/presence/implementation/mediums", ], ) diff --git a/presence/implementation/credential_manager.h b/presence/implementation/credential_manager.h index 68ebe735..e6f281d2 100644 --- a/presence/implementation/credential_manager.h +++ b/presence/implementation/credential_manager.h @@ -19,14 +19,14 @@ #include #include -#include "internal/platform/credential.h" #include "internal/platform/credential_storage.h" +#include "third_party/nearby/presence/credential.h" namespace nearby { namespace presence { struct GenerateCredentialsCallback { - std::function)> + std::function)> credentials_generated_cb; }; @@ -52,14 +52,13 @@ class CredentialManager { // The user’s own public credentials won’t be saved on local credential // storage. void GenerateCredentials( - location::nearby::DeviceMetadata device_metadata, - std::vector trust_types, + DeviceMetadata device_metadata, std::vector trust_types, GenerateCredentialsCallback credentials_generated_cb); // Update remote public credentials. void UpdateRemotePublicCredentials( std::string account_name, - std::vector remote_public_creds, + std::vector remote_public_creds, UpdateRemotePublicCredentialsCallback credentials_updated_cb); // Used to fetch private creds when broadcasting.