Change enum PublicCredentialType to enum class.

PiperOrigin-RevId: 486243753
This commit is contained in:
Janusz Sobczak
2022-11-04 15:26:34 -07:00
committed by Copybara-Service
parent f0440e96a9
commit 5faa395f24
2 changed files with 11 additions and 2 deletions
@@ -16,6 +16,7 @@
#define THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_IMPLEMENTATION_CREDENTIAL_CALLBACKS_H_
#include <functional>
#include <ostream>
#include <string>
#include <vector>
@@ -37,7 +38,7 @@ struct CredentialSelector {
::nearby::internal::IdentityType identity_type;
};
enum PublicCredentialType {
enum class PublicCredentialType {
kLocalPublicCredential = 1,
kRemotePublicCredential = 2,
};
@@ -62,6 +63,13 @@ struct GetPublicCredentialsResultCallback {
credentials_fetched_cb;
std::function<void(CredentialOperationStatus)> get_credentials_failed_cb;
};
inline std::ostream& operator<<(std::ostream& os,
const PublicCredentialType& credential_type) {
return os << "PublicCredentialType(" << static_cast<int>(credential_type)
<< ")";
}
} // namespace presence
} // namespace nearby
@@ -296,7 +296,8 @@ absl::StatusOr<std::string> CredentialManagerImpl::DecryptDataElements(
.identity_type = internal::IDENTITY_TYPE_PUBLIC,
};
ExceptionOr<std::vector<PublicCredential>> credentials =
GetPublicCredentialsSync(selector, kRemotePublicCredential, kTimeout);
GetPublicCredentialsSync(
selector, PublicCredentialType::kRemotePublicCredential, kTimeout);
if (!credentials.ok()) {
return absl::UnavailableError("Failed to fetch credentials");
}