Change interface of ClaimRootClientAuthToken and ConfirmAuthToken
Add RootClientTokenOwner argument to check if this owner can claim
device.
Add ErrorPtr to return error in privet response.
BUG=25766815
Change-Id: I508c934e23092514e37b1f4790f0f1e693583ae1
Reviewed-on: https://weave-review.googlesource.com/1939
Reviewed-by: Alex Vakulenko <avakulenko@google.com>
diff --git a/src/privet/auth_manager.cc b/src/privet/auth_manager.cc
index fa1d685..f38b854 100644
--- a/src/privet/auth_manager.cc
+++ b/src/privet/auth_manager.cc
@@ -146,7 +146,8 @@
}
std::vector<uint8_t> AuthManager::ClaimRootClientAuthToken(
- RootClientTokenOwner owner) {
+ RootClientTokenOwner owner,
+ ErrorPtr* error) {
pending_claims_.push_back(std::make_pair(
std::unique_ptr<AuthManager>{new AuthManager{nullptr, {}}}, owner));
if (pending_claims_.size() > kMaxPendingClaims)
@@ -154,7 +155,8 @@
return pending_claims_.back().first->GetRootClientAuthToken();
}
-bool AuthManager::ConfirmAuthToken(const std::vector<uint8_t>& token) {
+bool AuthManager::ConfirmAuthToken(const std::vector<uint8_t>& token,
+ ErrorPtr* error) {
// Cover case when caller sent confirm twice.
if (pending_claims_.empty() && IsValidAuthToken(token))
return true;