summaryrefslogtreecommitdiffstats
path: root/crates/auth-service/src/server/grpc/auth.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/auth-service/src/server/grpc/auth.rs')
-rw-r--r--crates/auth-service/src/server/grpc/auth.rs22
1 files changed, 20 insertions, 2 deletions
diff --git a/crates/auth-service/src/server/grpc/auth.rs b/crates/auth-service/src/server/grpc/auth.rs
index 87113a5..18e7546 100644
--- a/crates/auth-service/src/server/grpc/auth.rs
+++ b/crates/auth-service/src/server/grpc/auth.rs
@@ -3,8 +3,8 @@ use std::str::FromStr;
use jsonwebtoken::DecodingKey;
use sellershut_core::{
auth::{
- RegisterUserRequest, RegisterUserResponse, ValidationRequest, ValidationResponse,
- auth_server::Auth,
+ GetPrivateKeyRequest, GetPrivateKeyResponse, RegisterUserRequest, RegisterUserResponse,
+ ValidationRequest, ValidationResponse, auth_server::Auth,
},
users::CreateUserRequest,
};
@@ -136,4 +136,22 @@ impl Auth for AppHandle {
auth_id: user.id.to_string(),
}))
}
+
+ async fn get_private_key(
+ &self,
+ request: Request<GetPrivateKeyRequest>,
+ ) -> Result<Response<GetPrivateKeyResponse>, Status> {
+ let email = request.into_inner().email;
+
+ let private_key = sqlx::query_scalar!(
+ "select private_key from auth_user where email = $1
+ ",
+ uuid,
+ )
+ .fetch_one(&self.services.postgres)
+ .await
+ .unwrap();
+
+ Ok(Response::new(GetPrivateKeyResponse { private_key }))
+ }
}