Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3346869
D8606.id29626.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D8606.id29626.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D8606: [Identity] Refactor get user_id and device_id
Attached
Detach File
Event Timeline
Log In to Comment