Changeset View
Changeset View
Standalone View
Standalone View
services/identity/src/grpc_services/authenticated.rs
Show All 12 Lines | |||||
use comm_opaque2::grpc::protocol_error_to_grpc_status; | use comm_opaque2::grpc::protocol_error_to_grpc_status; | ||||
use tonic::{Request, Response, Status}; | use tonic::{Request, Response, Status}; | ||||
use tracing::{debug, error, warn}; | use tracing::{debug, error, warn}; | ||||
use super::protos::auth::{ | use super::protos::auth::{ | ||||
identity, identity_client_service_server::IdentityClientService, | identity, identity_client_service_server::IdentityClientService, | ||||
GetDeviceListRequest, GetDeviceListResponse, Identity, InboundKeyInfo, | GetDeviceListRequest, GetDeviceListResponse, Identity, InboundKeyInfo, | ||||
InboundKeysForUserRequest, InboundKeysForUserResponse, KeyserverKeysResponse, | InboundKeysForUserRequest, InboundKeysForUserResponse, KeyserverKeysResponse, | ||||
OutboundKeyInfo, OutboundKeysForUserRequest, OutboundKeysForUserResponse, | LinkFarcasterAccountRequest, OutboundKeyInfo, OutboundKeysForUserRequest, | ||||
RefreshUserPrekeysRequest, UpdateDeviceListRequest, | OutboundKeysForUserResponse, RefreshUserPrekeysRequest, | ||||
UpdateUserPasswordFinishRequest, UpdateUserPasswordStartRequest, | UpdateDeviceListRequest, UpdateUserPasswordFinishRequest, | ||||
UpdateUserPasswordStartResponse, UploadOneTimeKeysRequest, | UpdateUserPasswordStartRequest, UpdateUserPasswordStartResponse, | ||||
UploadOneTimeKeysRequest, | |||||
}; | }; | ||||
use super::protos::unauth::Empty; | use super::protos::unauth::Empty; | ||||
#[derive(derive_more::Constructor)] | #[derive(derive_more::Constructor)] | ||||
pub struct AuthenticatedService { | pub struct AuthenticatedService { | ||||
db_client: DatabaseClient, | db_client: DatabaseClient, | ||||
} | } | ||||
▲ Show 20 Lines • Show All 356 Lines • ▼ Show 20 Lines | ) -> Result<Response<Empty>, tonic::Status> { | ||||
self | self | ||||
.db_client | .db_client | ||||
.apply_devicelist_update(&user_id, update) | .apply_devicelist_update(&user_id, update) | ||||
.await | .await | ||||
.map_err(handle_db_error)?; | .map_err(handle_db_error)?; | ||||
Ok(Response::new(Empty {})) | Ok(Response::new(Empty {})) | ||||
} | } | ||||
async fn link_farcaster_account( | |||||
&self, | |||||
_request: tonic::Request<LinkFarcasterAccountRequest>, | |||||
) -> Result<Response<Empty>, tonic::Status> { | |||||
unimplemented!(); | |||||
} | |||||
} | } | ||||
// raw device list that can be serialized to JSON (and then signed in the future) | // raw device list that can be serialized to JSON (and then signed in the future) | ||||
#[derive(serde::Serialize, serde::Deserialize)] | #[derive(serde::Serialize, serde::Deserialize)] | ||||
struct RawDeviceList { | struct RawDeviceList { | ||||
devices: Vec<String>, | devices: Vec<String>, | ||||
timestamp: i64, | timestamp: i64, | ||||
} | } | ||||
▲ Show 20 Lines • Show All 132 Lines • Show Last 20 Lines |