Pass Config pointer into AuthManager
AuthManager needs to have logic for re-claming devices. This requires
persistent storage for secret and owner. It's going to be easier to
handle logic there than outside.
BUG=25766815
Change-Id: Icc417f23715b48461098503fd241cee534d2225c
Reviewed-on: https://weave-review.googlesource.com/1949
Reviewed-by: Vitaly Buka <vitalybuka@google.com>
diff --git a/src/privet/auth_manager.h b/src/privet/auth_manager.h
index 8fcadfc..dd4ad3d 100644
--- a/src/privet/auth_manager.h
+++ b/src/privet/auth_manager.h
@@ -16,10 +16,17 @@
#include "src/privet/privet_types.h"
namespace weave {
+
+class Config;
+
namespace privet {
class AuthManager {
public:
+ AuthManager(Config* config,
+ const std::vector<uint8_t>& certificate_fingerprint);
+
+ // Constructor for tests.
AuthManager(const std::vector<uint8_t>& secret,
const std::vector<uint8_t>& certificate_fingerprint,
base::Clock* clock = nullptr);
@@ -43,8 +50,11 @@
bool IsValidAuthToken(const std::vector<uint8_t>& token) const;
private:
+ void SetSecret(const std::vector<uint8_t>& secret);
+
+ Config* config_{nullptr};
base::DefaultClock default_clock_;
- base::Clock* clock_{nullptr};
+ base::Clock* clock_{&default_clock_};
std::vector<uint8_t> secret_;
std::vector<uint8_t> certificate_fingerprint_;