Page MenuHomePhabricator

D8606.id29626.diff
No OneTemporary

D8606.id29626.diff

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
@@ -68,16 +68,24 @@
Ok(req)
}
+pub fn get_user_and_device_id<T>(
+ request: &Request<T>,
+) -> Result<(String, String), Status> {
+ let user_id = get_value(&request, "user_id")
+ .ok_or(Status::unauthenticated("Missing user_id field"))?;
+ let device_id = get_value(&request, "device_id")
+ .ok_or(Status::unauthenticated("Missing device_id field"))?;
+
+ return Ok((user_id, device_id));
+}
+
#[tonic::async_trait]
impl IdentityClientService for AuthenticatedService {
async fn refresh_user_pre_keys(
&self,
request: Request<RefreshUserPreKeysRequest>,
) -> Result<Response<Empty>, Status> {
- let user_id = get_value(&request, "user_id")
- .ok_or(Status::unauthenticated("Missing user_id field"))?;
- let device_id = get_value(&request, "device_id")
- .ok_or(Status::unauthenticated("Missing device_id field"))?;
+ let (user_id, device_id) = get_user_and_device_id(&request)?;
let message = request.into_inner();
debug!("Refreshing prekeys for user: {}", user_id);

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 23, 10:05 AM (14 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2568072
Default Alt Text
D8606.id29626.diff (1 KB)

Event Timeline