Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(795)

Unified Diff: chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.h

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.h
diff --git a/chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.h b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.h
index f08bb49b4d31f1e27c109a4d8c2896369bb53ee3..2b4d0ea2510db6aadf4f22880150407467e17b88 100644
--- a/chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.h
+++ b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.h
@@ -12,11 +12,16 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "components/keyed_service/core/keyed_service.h"
+#include "components/user_manager/user_id.h"
#include "crypto/scoped_nss_types.h"
class PrefRegistrySimple;
class PrefService;
+namespace user_manager {
+class UserID;
+}
+
// Manages per user RSA keys stored in system TPM slot used in easy signin
// protocol. The keys are used to sign a nonce exchanged during signin.
class EasyUnlockTpmKeyManager : public KeyedService {
@@ -25,14 +30,14 @@ class EasyUnlockTpmKeyManager : public KeyedService {
static void RegisterLocalStatePrefs(PrefRegistrySimple* registry);
// Clears local state for user. Should be called when a user is removed.
- static void ResetLocalStateForUser(const std::string& user_id);
+ static void ResetLocalStateForUser(const user_manager::UserID& user_id);
// |user_id|: Id for the user associated with the service. Empty for sign-in
// service.
// |username_hash|: Username hash for the user associated with the service.
// Empty for sign-in service.
// |local_state|: The local state prefs.
- EasyUnlockTpmKeyManager(const std::string& user_id,
+ EasyUnlockTpmKeyManager(const user_manager::UserID& user_id,
const std::string& username_hash,
PrefService* local_state);
~EasyUnlockTpmKeyManager() override;
@@ -64,12 +69,12 @@ class EasyUnlockTpmKeyManager : public KeyedService {
bool StartGetSystemSlotTimeoutMs(size_t timeout_ms);
// Gets the public RSA key for user. The key is retrieved from local state.
- std::string GetPublicTpmKey(const std::string& user_id);
+ std::string GetPublicTpmKey(const user_manager::UserID& user_id);
// Signs |data| using private RSA key associated with |user_id| stored in TPM
// system slot.
void SignUsingTpmKey(
- const std::string& user_id,
+ const user_manager::UserID& user_id,
const std::string& data,
const base::Callback<void(const std::string& data)> callback);
@@ -86,7 +91,7 @@ class EasyUnlockTpmKeyManager : public KeyedService {
// Utility method for setting public key values in local state.
// Note that the keys are saved base64 encoded.
- void SetKeyInLocalState(const std::string& user_id,
+ void SetKeyInLocalState(const user_manager::UserID& user_id,
const std::string& value);
// Called when TPM system slot is initialized and ready to be used.
@@ -128,7 +133,7 @@ class EasyUnlockTpmKeyManager : public KeyedService {
const base::Callback<void(const std::string&)>& callback,
const std::string& signature);
- std::string user_id_;
+ user_manager::UserID user_id_;
std::string username_hash_;
PrefService* local_state_;

Powered by Google App Engine
This is Rietveld 408576698