Page MenuHomePhabricator

D4146.diff
No OneTemporary

D4146.diff

diff --git a/services/identity/src/database.rs b/services/identity/src/database.rs
--- a/services/identity/src/database.rs
+++ b/services/identity/src/database.rs
@@ -84,7 +84,7 @@
&self,
user_id: String,
registration: ServerRegistration<Cipher>,
- ) -> Result<PutItemOutput, RusotoError<PutItemError>> {
+ ) -> Result<PutItemOutput, Error> {
let input = PutItemInput {
table_name: "identity-pake-registration".to_string(),
item: HashMap::from([
@@ -105,7 +105,7 @@
]),
..PutItemInput::default()
};
- self.client.put_item(input).await
+ self.client.put_item(input).await.map_err(Error::RusotoPut)
}
pub async fn get_token(
diff --git a/services/identity/src/service.rs b/services/identity/src/service.rs
--- a/services/identity/src/service.rs
+++ b/services/identity/src/service.rs
@@ -1,14 +1,18 @@
use futures_core::Stream;
use opaque_ke::{
errors::ProtocolError, RegistrationRequest as PakeRegistrationRequest,
- ServerRegistration,
+ RegistrationUpload, ServerRegistration,
};
use rand::{CryptoRng, Rng};
use std::pin::Pin;
use tokio::sync::mpsc::{error::SendError, Sender};
use tonic::{Request, Response, Status};
-use crate::{config::Config, database::DatabaseClient, opaque::Cipher};
+use crate::{
+ config::Config,
+ database::{DatabaseClient, Error as DatabaseError},
+ opaque::Cipher,
+};
pub use proto::identity_service_server::IdentityServiceServer;
use proto::{
@@ -86,6 +90,23 @@
.map_err(Error::Channel)?;
Ok(())
}
+
+ async fn pake_registration_finish(
+ &self,
+ user_id: String,
+ pake_registration_upload: &Vec<u8>,
+ server_registration: ServerRegistration<Cipher>,
+ ) -> Result<(), Error> {
+ let server_registration_finish_result = server_registration.finish(
+ RegistrationUpload::<Cipher>::deserialize(pake_registration_upload)?,
+ )?;
+ self
+ .client
+ .put_pake_registration(user_id, server_registration_finish_result)
+ .await
+ .map_err(Error::Database)?;
+ Ok(())
+ }
}
#[derive(
@@ -96,4 +117,6 @@
Pake(ProtocolError),
#[display(...)]
Channel(SendError<Result<RegistrationResponse, Status>>),
+ #[display(...)]
+ Database(DatabaseError),
}

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 1, 4:00 AM (19 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2603590
Default Alt Text
D4146.diff (2 KB)

Event Timeline