Index: components/cryptauth/device_to_device_authenticator.cc |
diff --git a/components/cryptauth/device_to_device_authenticator.cc b/components/cryptauth/device_to_device_authenticator.cc |
index d80449ffaa05d80d216e5663cea571e3bde28616..caf601cc12034050f782beb91248378553a879e8 100644 |
--- a/components/cryptauth/device_to_device_authenticator.cc |
+++ b/components/cryptauth/device_to_device_authenticator.cc |
@@ -15,6 +15,7 @@ |
#include "components/cryptauth/device_to_device_secure_context.h" |
#include "components/cryptauth/secure_context.h" |
#include "components/cryptauth/secure_message_delegate.h" |
+#include "components/cryptauth/session_keys.h" |
#include "components/cryptauth/wire_message.h" |
#include "components/proximity_auth/logging/logging.h" |
@@ -154,7 +155,7 @@ void DeviceToDeviceAuthenticator::OnResponderAuthTimedOut() { |
void DeviceToDeviceAuthenticator::OnResponderAuthValidated( |
bool validated, |
- const std::string& session_symmetric_key) { |
+ std::unique_ptr<SessionKeys> session_keys) { |
if (!validated) { |
Fail("Unable to validated [Responder Auth]"); |
return; |
@@ -163,11 +164,11 @@ void DeviceToDeviceAuthenticator::OnResponderAuthValidated( |
PA_LOG(INFO) << "Successfully validated [Responder Auth]! " |
<< "Sending [Initiator Auth]..."; |
state_ = State::VALIDATED_RESPONDER_AUTH; |
- session_symmetric_key_ = session_symmetric_key; |
+ session_keys_ = std::move(session_keys); |
// Create the [Initiator Auth] message to send to the remote device. |
DeviceToDeviceInitiatorOperations::CreateInitiatorAuthMessage( |
- session_symmetric_key, |
+ session_keys_.get(), |
connection_->remote_device().persistent_symmetric_key, |
responder_auth_message_, secure_message_delegate_.get(), |
base::Bind(&DeviceToDeviceAuthenticator::OnInitiatorAuthCreated, |
@@ -204,7 +205,7 @@ void DeviceToDeviceAuthenticator::Fail(const std::string& error_message, |
void DeviceToDeviceAuthenticator::Succeed() { |
DCHECK(state_ == State::SENT_INITIATOR_AUTH); |
- DCHECK(!session_symmetric_key_.empty()); |
+ DCHECK(session_keys_); |
PA_LOG(INFO) << "Authentication succeeded!"; |
state_ = State::AUTHENTICATION_SUCCESS; |
@@ -212,7 +213,7 @@ void DeviceToDeviceAuthenticator::Succeed() { |
callback_.Run( |
Result::SUCCESS, |
base::MakeUnique<DeviceToDeviceSecureContext>( |
- std::move(secure_message_delegate_), session_symmetric_key_, |
+ std::move(secure_message_delegate_), std::move(session_keys_), |
responder_auth_message_, SecureContext::PROTOCOL_VERSION_THREE_ONE)); |
} |