mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Consolidate credential_storage callback functions. Move all callback struct definitions in a central header file compiled as part of internal/platform/implementation:comm library.
PiperOrigin-RevId: 476186596
This commit is contained in:
committed by
Copybara-Service
parent
0e6e22b4db
commit
fd59e9aede
@@ -20,45 +20,13 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "internal/platform/implementation/credential_callbacks.h"
|
||||
#include "internal/proto/credential.pb.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace api {
|
||||
|
||||
enum class CredentialOperationStatus {
|
||||
kUnknown = 0,
|
||||
kFailed = 1,
|
||||
kSucceeded = 2,
|
||||
};
|
||||
|
||||
struct CredentialSelector {
|
||||
std::string manager_app_id;
|
||||
std::string account_name;
|
||||
::nearby::internal::IdentityType identity_type;
|
||||
};
|
||||
|
||||
enum PublicCredentialType {
|
||||
kLocalPublicCredential = 1,
|
||||
kRemotePublicCredential = 2,
|
||||
};
|
||||
|
||||
struct SaveCredentialsResultCallback {
|
||||
std::function<void(CredentialOperationStatus)> credentials_saved_cb;
|
||||
};
|
||||
|
||||
struct GetPrivateCredentialsResultCallback {
|
||||
std::function<void(std::vector<::nearby::internal::PrivateCredential>)>
|
||||
credentials_fetched_cb;
|
||||
std::function<void(CredentialOperationStatus)> get_credentials_failed_cb;
|
||||
};
|
||||
|
||||
struct GetPublicCredentialsResultCallback {
|
||||
std::function<void(std::vector<::nearby::internal::PublicCredential>)>
|
||||
credentials_fetched_cb;
|
||||
std::function<void(CredentialOperationStatus)> get_credentials_failed_cb;
|
||||
};
|
||||
|
||||
/*
|
||||
* This class specifies the virtual functions for native platforms to implement.
|
||||
*/
|
||||
@@ -76,19 +44,19 @@ class CredentialStorage {
|
||||
private_credentials,
|
||||
const std::vector<::nearby::internal::PublicCredential>&
|
||||
public_credentials,
|
||||
PublicCredentialType public_credential_type,
|
||||
SaveCredentialsResultCallback callback) = 0;
|
||||
::nearby::presence::PublicCredentialType public_credential_type,
|
||||
::nearby::presence::GenerateCredentialsCallback callback) = 0;
|
||||
|
||||
// Used to fetch private creds when broadcasting.
|
||||
virtual void GetPrivateCredentials(
|
||||
const CredentialSelector& credential_selector,
|
||||
GetPrivateCredentialsResultCallback callback) = 0;
|
||||
const ::nearby::presence::CredentialSelector& credential_selector,
|
||||
::nearby::presence::GetPrivateCredentialsResultCallback callback) = 0;
|
||||
|
||||
// Used to fetch remote public creds when scanning.
|
||||
virtual void GetPublicCredentials(
|
||||
const CredentialSelector& credential_selector,
|
||||
PublicCredentialType public_credential_type,
|
||||
GetPublicCredentialsResultCallback callback) = 0;
|
||||
const ::nearby::presence::CredentialSelector& credential_selector,
|
||||
::nearby::presence::PublicCredentialType public_credential_type,
|
||||
::nearby::presence::GetPublicCredentialsResultCallback callback) = 0;
|
||||
};
|
||||
|
||||
} // namespace api
|
||||
|
||||
Reference in New Issue
Block a user