Page MenuHomePhabricator

D4386.diff
No OneTemporary

D4386.diff

diff --git a/services/identity/src/service.rs b/services/identity/src/service.rs
--- a/services/identity/src/service.rs
+++ b/services/identity/src/service.rs
@@ -94,26 +94,19 @@
pake_registration_request_and_user_id,
)),
}) => {
- if let Err(e) = tx
- .send(
- pake_registration_start(
- config.clone(),
- &mut OsRng,
- &pake_registration_request_and_user_id
- .pake_registration_request,
- num_messages_received,
- )
- .await
- .map(
- |registration_response_and_server_registration| {
- server_registration =
- Some(registration_response_and_server_registration.1);
- registration_response_and_server_registration.0
- },
- ),
- )
- .await
- {
+ let registration_start_result = pake_registration_start(
+ config.clone(),
+ &mut OsRng,
+ &pake_registration_request_and_user_id.pake_registration_request,
+ num_messages_received,
+ )
+ .await
+ .map(|registration_response_and_server_registration| {
+ server_registration =
+ Some(registration_response_and_server_registration.1);
+ registration_response_and_server_registration.0
+ });
+ if let Err(e) = tx.send(registration_start_result).await {
error!("Response was dropped: {}", e);
break;
}
@@ -126,43 +119,39 @@
pake_registration_upload_and_credential_request,
)),
}) => {
- if let Err(e) = tx
- .send(
- match pake_registration_finish(
- &user_id,
+ let registration_finish_and_login_start_result =
+ match pake_registration_finish(
+ &user_id,
+ client.clone(),
+ &pake_registration_upload_and_credential_request
+ .pake_registration_upload,
+ server_registration,
+ num_messages_received,
+ )
+ .await
+ {
+ Ok(_) => pake_login_start(
+ config.clone(),
client.clone(),
+ &user_id.clone(),
&pake_registration_upload_and_credential_request
- .pake_registration_upload,
- server_registration,
+ .pake_credential_request,
num_messages_received,
+ PakeWorkflow::Registration,
)
.await
- {
- Ok(_) => pake_login_start(
- config.clone(),
- client.clone(),
- &user_id.clone(),
- &pake_registration_upload_and_credential_request
- .pake_credential_request,
- num_messages_received,
- PakeWorkflow::Registration,
- )
- .await
- .map(
- |pake_login_response_and_server_login| {
- server_login =
- Some(pake_login_response_and_server_login.1);
- RegistrationResponse {
- data: Some(PakeRegistrationLoginResponse(
- pake_login_response_and_server_login.0,
- )),
- }
- },
- ),
- Err(e) => Err(e),
- },
- )
- .await
+ .map(|pake_login_response_and_server_login| {
+ server_login = Some(pake_login_response_and_server_login.1);
+ RegistrationResponse {
+ data: Some(PakeRegistrationLoginResponse(
+ pake_login_response_and_server_login.0,
+ )),
+ }
+ }),
+ Err(e) => Err(e),
+ };
+ if let Err(e) =
+ tx.send(registration_finish_and_login_start_result).await
{
error!("Response was dropped: {}", e);
break;
@@ -175,29 +164,21 @@
pake_credential_finalization,
)),
}) => {
- if let Err(e) = tx
- .send(
- pake_login_finish(
- &user_id,
- &device_id,
- client,
- server_login,
- &pake_credential_finalization,
- &mut OsRng,
- num_messages_received,
- PakeWorkflow::Registration,
- )
- .await
- .map(|pake_login_response| {
- RegistrationResponse {
- data: Some(PakeRegistrationLoginResponse(
- pake_login_response,
- )),
- }
- }),
- )
- .await
- {
+ let login_finish_result = pake_login_finish(
+ &user_id,
+ &device_id,
+ client,
+ server_login,
+ &pake_credential_finalization,
+ &mut OsRng,
+ num_messages_received,
+ PakeWorkflow::Registration,
+ )
+ .await
+ .map(|pake_login_response| RegistrationResponse {
+ data: Some(PakeRegistrationLoginResponse(pake_login_response)),
+ });
+ if let Err(e) = tx.send(login_finish_result).await {
error!("Response was dropped: {}", e);
}
break;
@@ -242,18 +223,14 @@
Ok(LoginRequest {
data: Some(WalletLoginRequest(req)),
}) => {
- if let Err(e) = tx
- .send(
- wallet_login_helper(
- client,
- req,
- &mut OsRng,
- num_messages_received,
- )
- .await,
- )
- .await
- {
+ let wallet_login_result = wallet_login_helper(
+ client,
+ req,
+ &mut OsRng,
+ num_messages_received,
+ )
+ .await;
+ if let Err(e) = tx.send(wallet_login_result).await {
error!("Response was dropped: {}", e);
}
break;
@@ -267,28 +244,24 @@
)),
})),
}) => {
- if let Err(e) = tx
- .send(
- pake_login_start(
- config.clone(),
- client.clone(),
- &pake_credential_request_and_user_id.user_id,
- &pake_credential_request_and_user_id.pake_credential_request,
- num_messages_received,
- PakeWorkflow::Login,
- )
- .await
- .map(|pake_login_response_and_server_login| {
- server_login = Some(pake_login_response_and_server_login.1);
- LoginResponse {
- data: Some(PakeLoginResponse(
- pake_login_response_and_server_login.0,
- )),
- }
- }),
- )
- .await
- {
+ let login_start_result = pake_login_start(
+ config.clone(),
+ client.clone(),
+ &pake_credential_request_and_user_id.user_id,
+ &pake_credential_request_and_user_id.pake_credential_request,
+ num_messages_received,
+ PakeWorkflow::Login,
+ )
+ .await
+ .map(|pake_login_response_and_server_login| {
+ server_login = Some(pake_login_response_and_server_login.1);
+ LoginResponse {
+ data: Some(PakeLoginResponse(
+ pake_login_response_and_server_login.0,
+ )),
+ }
+ });
+ if let Err(e) = tx.send(login_start_result).await {
error!("Response was dropped: {}", e);
break;
}
@@ -302,25 +275,21 @@
Some(PakeCredentialFinalization(pake_credential_finalization)),
})),
}) => {
- if let Err(e) = tx
- .send(
- pake_login_finish(
- &user_id,
- &device_id,
- client,
- server_login,
- &pake_credential_finalization,
- &mut OsRng,
- num_messages_received,
- PakeWorkflow::Login,
- )
- .await
- .map(|pake_login_response| LoginResponse {
- data: Some(PakeLoginResponse(pake_login_response)),
- }),
- )
- .await
- {
+ let login_finish_result = pake_login_finish(
+ &user_id,
+ &device_id,
+ client,
+ server_login,
+ &pake_credential_finalization,
+ &mut OsRng,
+ num_messages_received,
+ PakeWorkflow::Login,
+ )
+ .await
+ .map(|pake_login_response| LoginResponse {
+ data: Some(PakeLoginResponse(pake_login_response)),
+ });
+ if let Err(e) = tx.send(login_finish_result).await {
error!("Response was dropped: {}", e);
}
break;

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 9:11 AM (20 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2521147
Default Alt Text
D4386.diff (9 KB)

Event Timeline