From 7e6c6eace6f334191e0c6e7fbeaa0a9d5825999a Mon Sep 17 00:00:00 2001 From: Valentin Tolmer Date: Wed, 16 Jun 2021 19:12:41 +0200 Subject: [PATCH] Add messages for the OPAQUE protocol --- model/src/lib.rs | 50 +++++++++++++++++++++++++++++++++++++++++++++ model/src/opaque.rs | 1 + 2 files changed, 51 insertions(+) diff --git a/model/src/lib.rs b/model/src/lib.rs index 1a0746c..b84d74f 100644 --- a/model/src/lib.rs +++ b/model/src/lib.rs @@ -10,6 +10,56 @@ pub struct BindRequest { pub password: String, } +/// The messages for the 3-step OPAQUE login process. +pub mod login { + use super::*; + + #[derive(Serialize, Deserialize, Clone)] + pub struct ClientLoginStartRequest { + pub username: String, + pub login_start_request: opaque::server::login::CredentialRequest, + } + + #[derive(Serialize, Deserialize, Clone)] + pub struct ServerLoginStartResponse { + /// A randomly-generated temporary key that corresponds to this login attempt. + pub login_key: String, + pub credential_response: opaque::client::login::CredentialResponse, + } + + #[derive(Serialize, Deserialize, Clone)] + pub struct ClientLoginFinishRequest { + /// The key returned by the server in the previous step. + pub login_key: String, + pub credential_finalization: opaque::client::login::CredentialFinalization, + } +} + +/// The messages for the 3-step OPAQUE registration process. +pub mod registration { + use super::*; + + #[derive(Serialize, Deserialize, Clone)] + pub struct ClientRegistrationStartRequest { + pub username: String, + pub registration_start_request: opaque::server::registration::RegistrationRequest, + } + + #[derive(Serialize, Deserialize, Clone)] + pub struct ServerRegistrationStartResponse { + /// A randomly-generated temporary key that corresponds to this registration attempt. + pub registration_key: String, + pub registration_response: opaque::client::registration::RegistrationResponse, + } + + #[derive(Serialize, Deserialize, Clone)] + pub struct ClientRegistrationFinishRequest { + /// The key returned by the server in the previous step. + pub registration_key: String, + pub registration_upload: opaque::server::registration::RegistrationUpload, + } +} + #[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone)] pub enum RequestFilter { And(Vec), diff --git a/model/src/opaque.rs b/model/src/opaque.rs index 962b033..eecd849 100644 --- a/model/src/opaque.rs +++ b/model/src/opaque.rs @@ -100,6 +100,7 @@ pub mod client { pub type ClientLoginFinishResult = opaque_ke::ClientLoginFinishResult; pub type ClientLoginStartResult = opaque_ke::ClientLoginStartResult; pub type CredentialResponse = opaque_ke::CredentialResponse; + pub type CredentialFinalization = opaque_ke::CredentialFinalization; pub use opaque_ke::{ ClientLoginFinishParameters, ClientLoginStartParameters,