Page MenuHomePhabricator

D10052.id33702.diff
No OneTemporary

D10052.id33702.diff

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
@@ -11,7 +11,12 @@
use tracing::{debug, error};
// Workspace crate imports
-use crate::client_service::client_proto::{
+use crate::config::CONFIG;
+use crate::database::{
+ DBDeviceTypeInt, DatabaseClient, DeviceType, KeyPayload,
+};
+use crate::error::Error as DBError;
+use crate::grpc_services::protos::unauth::{
AddReservedUsernamesRequest, Empty, GenerateNonceResponse,
OpaqueLoginFinishRequest, OpaqueLoginFinishResponse, OpaqueLoginStartRequest,
OpaqueLoginStartResponse, RegistrationFinishRequest,
@@ -21,11 +26,6 @@
VerifyUserAccessTokenRequest, VerifyUserAccessTokenResponse,
WalletLoginRequest, WalletLoginResponse,
};
-use crate::config::CONFIG;
-use crate::database::{
- DBDeviceTypeInt, DatabaseClient, DeviceType, KeyPayload,
-};
-use crate::error::Error as DBError;
use crate::grpc_utils::DeviceKeyUploadActions;
use crate::id::generate_uuid;
use crate::nonce::generate_nonce_data;
@@ -36,13 +36,10 @@
};
use crate::siwe::{is_valid_ethereum_address, parse_and_verify_siwe_message};
use crate::token::{AccessTokenData, AuthType};
-pub use client_proto::identity_client_service_server::{
- IdentityClientService, IdentityClientServiceServer,
-};
-pub mod client_proto {
- tonic::include_proto!("identity.client");
-}
+pub use crate::grpc_services::protos::client::identity_client_service_server::{
+ IdentityClientService, IdentityClientServiceServer,
+ };
#[derive(Clone)]
pub enum WorkflowInProgress {
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
@@ -14,24 +14,18 @@
use comm_opaque2::grpc::protocol_error_to_grpc_status;
use moka::future::Cache;
use tonic::{Request, Response, Status};
+use tracing::{debug, error};
-// This must be named client, because generated code from the authenticated
-// protobuf file references message structs from the client protobuf file
-// with the client:: namespace
-use crate::client_service::client_proto as client;
-
-pub mod auth_proto {
- tonic::include_proto!("identity.authenticated");
-}
-use auth_proto::{
+use super::protos::auth::{
find_user_id_request, identity_client_service_server::IdentityClientService,
FindUserIdRequest, FindUserIdResponse, InboundKeyInfo,
InboundKeysForUserRequest, InboundKeysForUserResponse, KeyserverKeysResponse,
OutboundKeyInfo, OutboundKeysForUserRequest, OutboundKeysForUserResponse,
- RefreshUserPreKeysRequest, UploadOneTimeKeysRequest,
+ RefreshUserPreKeysRequest, UpdateUserPasswordFinishRequest,
+ UpdateUserPasswordStartRequest, UpdateUserPasswordStartResponse,
+ UploadOneTimeKeysRequest,
};
-use client::{Empty, IdentityKeyInfo};
-use tracing::{debug, error};
+use super::protos::client::{Empty, IdentityKeyInfo, PreKey};
#[derive(derive_more::Constructor)]
pub struct AuthenticatedService {
@@ -213,11 +207,11 @@
payload_signature: db_keys.key_payload_signature,
social_proof: db_keys.social_proof,
}),
- content_prekey: Some(client::PreKey {
+ content_prekey: Some(PreKey {
pre_key: db_keys.content_prekey.prekey,
pre_key_signature: db_keys.content_prekey.prekey_signature,
}),
- notif_prekey: Some(client::PreKey {
+ notif_prekey: Some(PreKey {
pre_key: db_keys.notif_prekey.prekey,
pre_key_signature: db_keys.notif_prekey.prekey_signature,
}),
@@ -279,11 +273,9 @@
async fn update_user_password_start(
&self,
- request: tonic::Request<auth_proto::UpdateUserPasswordStartRequest>,
- ) -> Result<
- tonic::Response<auth_proto::UpdateUserPasswordStartResponse>,
- tonic::Status,
- > {
+ request: tonic::Request<UpdateUserPasswordStartRequest>,
+ ) -> Result<tonic::Response<UpdateUserPasswordStartResponse>, tonic::Status>
+ {
let (user_id, _) = get_user_and_device_id(&request)?;
let message = request.into_inner();
@@ -302,7 +294,7 @@
.insert_with_uuid_key(WorkflowInProgress::Update(update_state))
.await;
- let response = auth_proto::UpdateUserPasswordStartResponse {
+ let response = UpdateUserPasswordStartResponse {
session_id,
opaque_registration_response: server_message,
};
@@ -311,7 +303,7 @@
async fn update_user_password_finish(
&self,
- request: tonic::Request<auth_proto::UpdateUserPasswordFinishRequest>,
+ request: tonic::Request<UpdateUserPasswordFinishRequest>,
) -> Result<tonic::Response<Empty>, tonic::Status> {
let message = request.into_inner();
diff --git a/services/identity/src/grpc_services/mod.rs b/services/identity/src/grpc_services/mod.rs
--- a/services/identity/src/grpc_services/mod.rs
+++ b/services/identity/src/grpc_services/mod.rs
@@ -1,2 +1,16 @@
pub mod authenticated;
pub mod shared;
+
+pub mod protos {
+ pub mod unauth {
+ tonic::include_proto!("identity.client");
+ }
+ pub mod auth {
+ tonic::include_proto!("identity.authenticated");
+ }
+
+ // This must be named client, because generated code from the authenticated
+ // protobuf file references message structs from the client protobuf file
+ // with the client:: namespace
+ pub use self::unauth as client;
+}
diff --git a/services/identity/src/grpc_utils.rs b/services/identity/src/grpc_utils.rs
--- a/services/identity/src/grpc_utils.rs
+++ b/services/identity/src/grpc_utils.rs
@@ -4,11 +4,6 @@
use tracing::error;
use crate::{
- client_service::client_proto::{
- DeviceKeyUpload, IdentityKeyInfo, OpaqueLoginStartRequest, PreKey,
- RegistrationStartRequest, ReservedRegistrationStartRequest,
- ReservedWalletLoginRequest, WalletLoginRequest,
- },
constants::{
CONTENT_ONE_TIME_KEY, NOTIF_ONE_TIME_KEY,
USERS_TABLE_DEVICES_MAP_CONTENT_PREKEY_ATTRIBUTE_NAME,
@@ -20,7 +15,14 @@
USERS_TABLE_DEVICES_MAP_SOCIAL_PROOF_ATTRIBUTE_NAME,
},
database::DeviceKeys,
- grpc_services::authenticated::auth_proto::{InboundKeyInfo, OutboundKeyInfo},
+ grpc_services::protos::{
+ auth::{InboundKeyInfo, OutboundKeyInfo},
+ unauth::{
+ DeviceKeyUpload, IdentityKeyInfo, OpaqueLoginStartRequest, PreKey,
+ RegistrationStartRequest, ReservedRegistrationStartRequest,
+ ReservedWalletLoginRequest, WalletLoginRequest,
+ },
+ },
token::AuthType,
};
diff --git a/services/identity/src/main.rs b/services/identity/src/main.rs
--- a/services/identity/src/main.rs
+++ b/services/identity/src/main.rs
@@ -31,8 +31,8 @@
use tracing_subscriber::EnvFilter;
use client_service::{ClientService, IdentityClientServiceServer};
-use grpc_services::authenticated::auth_proto::identity_client_service_server::IdentityClientServiceServer as AuthServer;
use grpc_services::authenticated::AuthenticatedService;
+use grpc_services::protos::auth::identity_client_service_server::IdentityClientServiceServer as AuthServer;
#[derive(Parser)]
#[clap(author, version, about, long_about = None)]

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 27, 9:14 AM (15 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2589996
Default Alt Text
D10052.id33702.diff (7 KB)

Event Timeline