Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3393926
D4351.id13758.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
D4351.id13758.diff
View Options
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
@@ -343,3 +343,41 @@
}
}
}
+
+async fn pake_login_finish(
+ user_id: Option<String>,
+ device_id: Option<String>,
+ client: DatabaseClient,
+ server_login: Option<ServerLogin<Cipher>>,
+ pake_credential_finalization: &[u8],
+ rng: &mut (impl Rng + CryptoRng),
+ num_messages_received: u8,
+) -> Result<LoginResponse, Status> {
+ if num_messages_received != 1 {
+ error!("Too many messages received in stream, aborting");
+ return Err(Status::aborted("please retry"));
+ }
+ let user_id = user_id.ok_or_else(|| Status::aborted("user not found"))?;
+ let device_id = device_id.ok_or_else(|| Status::aborted("user not found"))?;
+ match server_login
+ .ok_or_else(|| Status::aborted("login failed"))?
+ .finish(
+ CredentialFinalization::deserialize(pake_credential_finalization)
+ .map_err(|e| {
+ error!("Failed to deserialize credential finalization bytes: {}", e);
+ Status::aborted("login failed")
+ })?,
+ ) {
+ Ok(_) => {
+ put_token_helper(client, AuthType::Password, user_id, device_id, rng)
+ .await
+ }
+ Err(e) => {
+ error!(
+ "Encountered a PAKE protocol error when finishing login: {}",
+ e
+ );
+ Err(Status::aborted("server error"))
+ }
+ }
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 1, 4:33 PM (20 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2605573
Default Alt Text
D4351.id13758.diff (1 KB)
Attached To
Mode
D4351: [services][identity] helper function to finish PAKE login
Attached
Detach File
Event Timeline
Log In to Comment