Skip to content

Commit

Permalink
[identity] Return use_new_flow in V1 login RPCs
Browse files Browse the repository at this point in the history
Summary:
Address part of [[ https://linear.app/comm/issue/ENG-9697/return-use-new-flows-for-old-flow-only-rpcs | ENG-9697 ]].

Depends on D14073

Test Plan: Used primary device logout to sign the device list, then tried V1 login again, the `use_new_flow` was returned.

Reviewers: kamil, varun

Reviewed By: kamil

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D14074
  • Loading branch information
barthap committed Dec 6, 2024
1 parent 8944ea4 commit a8129cf
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions services/identity/src/client_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,17 @@ impl IdentityClientService for ClientService {
));
};

if self
.client
.get_user_login_flow(&user_id)
.await?
.is_signed_device_list_flow()
{
return Err(tonic::Status::failed_precondition(
tonic_status_messages::USE_NEW_FLOW,
));
}

let flattened_device_key_upload =
construct_flattened_device_key_upload(&message)?;
self
Expand Down Expand Up @@ -484,6 +495,17 @@ impl IdentityClientService for ClientService {
.get_user_id_from_user_info(wallet_address.clone(), &AuthType::Wallet)
.await?
{
if self
.client
.get_user_login_flow(&user_id)
.await?
.is_signed_device_list_flow()
{
return Err(tonic::Status::failed_precondition(
tonic_status_messages::USE_NEW_FLOW,
));
}

self
.check_device_id_taken(&flattened_device_key_upload, Some(&user_id))
.await?;
Expand All @@ -510,6 +532,17 @@ impl IdentityClientService for ClientService {
));
};

if self
.client
.get_user_login_flow(&user_id)
.await?
.is_signed_device_list_flow()
{
return Err(tonic::Status::failed_precondition(
tonic_status_messages::USE_NEW_FLOW,
));
}

// It's possible that the user attempting login is already registered
// on Ashoat's keyserver. If they are, we should try to register them if
// they're on a mobile device, otherwise we should send back a gRPC status
Expand Down

0 comments on commit a8129cf

Please sign in to comment.