diff --git a/native/cpp/CommonCpp/grpc/protos/identity.proto b/native/cpp/CommonCpp/grpc/protos/identity.proto --- a/native/cpp/CommonCpp/grpc/protos/identity.proto +++ b/native/cpp/CommonCpp/grpc/protos/identity.proto @@ -42,7 +42,7 @@ // Answer sent to the user upon reception of the PAKE login attempt, // containing a sealed envelope with the user's private key (step 2) bytes pakeCredentialResponse = 1; - bytes token = 2; + string token = 2; } } @@ -110,7 +110,7 @@ message VerifyUserTokenRequest { string userID = 1; string deviceID = 2; - bytes token = 3; + string token = 3; } message VerifyUserTokenResponse { 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 @@ -288,7 +288,7 @@ match auth_type.as_str() { "password" => Ok(AuthType::Password), "wallet" => Ok(AuthType::Wallet), - unsupported => Err(Error::InvalidAuthType), + _unsupported => Err(Error::InvalidAuthType), } } else { Err(Error::MissingAttribute) 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 @@ -53,7 +53,20 @@ &self, request: Request, ) -> Result, Status> { - println!("Got a lookup request: {:?}", request); - unimplemented!() + let message = request.into_inner(); + match self + .client + .get_token(message.user_id, message.device_id) + .await + { + Ok(Some(access_token)) if message.token == access_token.token => { + Ok(Response::new(VerifyUserTokenResponse { + token_valid: access_token.valid, + })) + } + _ => Ok(Response::new(VerifyUserTokenResponse { + token_valid: false, + })), + } } }