diff --git a/services/identity/src/client_service.rs b/services/identity/src/client_service.rs
--- a/services/identity/src/client_service.rs
+++ b/services/identity/src/client_service.rs
@@ -704,9 +704,9 @@
let nonce = challenge_response.verify_and_get_nonce(&device_id)?;
self.verify_and_remove_nonce(&nonce).await?;
- let user_identifier = self
+ let user_identity = self
.client
- .get_user_identifier(&user_id)
+ .get_user_identity(&user_id)
.await
.map_err(handle_db_error)?
.ok_or_else(|| tonic::Status::not_found("user not found"))?;
@@ -728,11 +728,12 @@
}
let login_time = chrono::Utc::now();
+ let identifier = user_identity.identifier;
let token = AccessTokenData::with_created_time(
user_id.clone(),
device_id,
login_time,
- user_identifier.into(),
+ identifier.into(),
&mut OsRng,
);
let access_token = token.access_token.clone();
@@ -774,11 +775,11 @@
let nonce = challenge_response.verify_and_get_nonce(&device_id)?;
self.verify_and_remove_nonce(&nonce).await?;
- let (identifier_response, device_list_response) = tokio::join!(
- self.client.get_user_identifier(&user_id),
+ let (identity_response, device_list_response) = tokio::join!(
+ self.client.get_user_identity(&user_id),
self.client.get_current_device_list(&user_id)
);
- let user_identifier = identifier_response
+ let user_identity = identity_response
.map_err(handle_db_error)?
.ok_or_else(|| tonic::Status::not_found("user not found"))?;
@@ -796,11 +797,12 @@
}
let login_time = chrono::Utc::now();
+ let identifier = user_identity.identifier;
let token = AccessTokenData::with_created_time(
user_id.clone(),
device_id,
login_time,
- user_identifier.into(),
+ identifier.into(),
&mut OsRng,
);
let access_token = token.access_token.clone();
diff --git a/services/identity/src/database.rs b/services/identity/src/database.rs
--- a/services/identity/src/database.rs
+++ b/services/identity/src/database.rs
@@ -22,7 +22,7 @@
ddb_utils::EthereumIdentity, reserved_users::UserDetail, siwe::SocialProof,
};
use crate::{
- ddb_utils::{Identifier, OlmAccountType},
+ ddb_utils::{DBIdentity, OlmAccountType},
grpc_services::protos,
};
use crate::{error::Error, grpc_utils::DeviceKeysInfo};
@@ -723,15 +723,15 @@
/// Retrieves username for password users or wallet address for wallet users
/// Returns `None` if user not found
#[tracing::instrument(skip_all)]
- pub async fn get_user_identifier(
+ pub async fn get_user_identity(
&self,
user_id: &str,
- ) -> Result