proximity_auth_client.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright 2015 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef ASH_COMPONENTS_PROXIMITY_AUTH_PROXIMITY_AUTH_CLIENT_H_
  5. #define ASH_COMPONENTS_PROXIMITY_AUTH_PROXIMITY_AUTH_CLIENT_H_
  6. #include <memory>
  7. #include <string>
  8. #include "ash/components/proximity_auth/proximity_auth_pref_manager.h"
  9. #include "ash/public/cpp/smartlock_state.h"
  10. #include "ash/services/device_sync/proto/cryptauth_api.pb.h"
  11. #include "base/callback_forward.h"
  12. namespace proximity_auth {
  13. // An interface that needs to be supplied to the Proximity Auth component by its
  14. // embedder. There should be one |ProximityAuthClient| per
  15. // |content::BrowserContext|.
  16. class ProximityAuthClient {
  17. public:
  18. virtual ~ProximityAuthClient() {}
  19. // Updates the user pod on the signin or lock screen to reflect the provided
  20. // Smart Lock state.
  21. virtual void UpdateSmartLockState(ash::SmartLockState state) = 0;
  22. // Finalizes an unlock attempt initiated by the user. If |success| is true,
  23. // the screen is unlocked; otherwise, the auth attempt is rejected. An auth
  24. // attempt must be in progress before calling this function.
  25. virtual void FinalizeUnlock(bool success) = 0;
  26. // Finalizes a sign-in attempt initiated by the user. If |secret| is valid,
  27. // the user is signed in; otherwise, the auth attempt is rejected. An auth
  28. // attempt must be in progress before calling this function.
  29. virtual void FinalizeSignin(const std::string& secret) = 0;
  30. // Gets the wrapped challenge for the given |user_id| and |remote_public_key|
  31. // of the user's remote device. The challenge binds to the secure channel
  32. // using |channel_binding_data|.
  33. // |callback| will be invoked when the challenge is acquired.
  34. virtual void GetChallengeForUserAndDevice(
  35. const std::string& user_email,
  36. const std::string& remote_public_key,
  37. const std::string& channel_binding_data,
  38. base::OnceCallback<void(const std::string& challenge)> callback) = 0;
  39. // Returns the manager responsible for EasyUnlock preferences.
  40. virtual ProximityAuthPrefManager* GetPrefManager() = 0;
  41. };
  42. } // namespace proximity_auth
  43. #endif // ASH_COMPONENTS_PROXIMITY_AUTH_PROXIMITY_AUTH_CLIENT_H_