diff --git a/services/identity/src/grpc_services/authenticated.rs b/services/identity/src/grpc_services/authenticated.rs --- a/services/identity/src/grpc_services/authenticated.rs +++ b/services/identity/src/grpc_services/authenticated.rs @@ -262,13 +262,21 @@ Some(Identifier::WalletAddress(address)) => (address, AuthType::Wallet), }; - let user_id = self - .db_client - .get_user_id_from_user_info(user_ident, &auth_type) - .await - .map_err(handle_db_error)?; - - Ok(Response::new(FindUserIdResponse { user_id })) + let (is_reserved_result, user_id_result) = tokio::join!( + self + .db_client + .username_in_reserved_usernames_table(&user_ident), + self + .db_client + .get_user_id_from_user_info(user_ident.clone(), &auth_type), + ); + let is_reserved = is_reserved_result.map_err(handle_db_error)?; + let user_id = user_id_result.map_err(handle_db_error)?; + + Ok(Response::new(FindUserIdResponse { + user_id, + is_reserved, + })) } async fn update_user_password_start( diff --git a/shared/protos/identity_authenticated.proto b/shared/protos/identity_authenticated.proto --- a/shared/protos/identity_authenticated.proto +++ b/shared/protos/identity_authenticated.proto @@ -126,8 +126,12 @@ } message FindUserIDResponse { - // none if user not found + // userID if the user is registered with Identity Service, null otherwise optional string userID = 1; + // true if the identifier (username or wallet address) exists in the + // reserved usernames list, false otherwise. It doesn't take into account + // whether the user is registered with Identity Service (userID != null). + bool is_reserved = 2; } // UpdateUserPassword