Page MenuHomePhabricator

D12175.id40724.diff
No OneTemporary

D12175.id40724.diff

diff --git a/shared/comm-opaque2/src/client/login.rs b/shared/comm-opaque2/src/client/login.rs
--- a/shared/comm-opaque2/src/client/login.rs
+++ b/shared/comm-opaque2/src/client/login.rs
@@ -45,11 +45,8 @@
let password = self
.password
.take()
- .ok_or_else(|| ProtocolError::InvalidLoginError)?;
- let state = self
- .state
- .take()
- .ok_or_else(|| ProtocolError::InvalidLoginError)?;
+ .ok_or(ProtocolError::InvalidLoginError)?;
+ let state = self.state.take().ok_or(ProtocolError::InvalidLoginError)?;
let result = state.finish(
password.as_bytes(),
response,
@@ -70,3 +67,9 @@
}
}
}
+
+impl Default for Login {
+ fn default() -> Self {
+ Self::new()
+ }
+}
diff --git a/shared/comm-opaque2/src/client/register.rs b/shared/comm-opaque2/src/client/register.rs
--- a/shared/comm-opaque2/src/client/register.rs
+++ b/shared/comm-opaque2/src/client/register.rs
@@ -39,10 +39,7 @@
response_payload: &[u8],
) -> Result<Vec<u8>, OpaqueError> {
let response = RegistrationResponse::deserialize(response_payload)?;
- let state = self
- .state
- .take()
- .ok_or_else(|| ProtocolError::InvalidLoginError)?;
+ let state = self.state.take().ok_or(ProtocolError::InvalidLoginError)?;
let result = state.finish(
&mut self.rng,
password.as_bytes(),
@@ -55,3 +52,9 @@
Ok(result.message.serialize().to_vec())
}
}
+
+impl Default for Registration {
+ fn default() -> Self {
+ Self::new()
+ }
+}
diff --git a/shared/comm-opaque2/src/error.rs b/shared/comm-opaque2/src/error.rs
--- a/shared/comm-opaque2/src/error.rs
+++ b/shared/comm-opaque2/src/error.rs
@@ -8,15 +8,15 @@
#[derive(Debug)]
pub struct OpaqueError(ProtocolError);
-impl Into<JsValue> for OpaqueError {
- fn into(self) -> JsValue {
- JsValue::from(protocol_error_to_js_error(self.0))
+impl From<OpaqueError> for JsValue {
+ fn from(value: OpaqueError) -> Self {
+ Self::from(protocol_error_to_js_error(value.0))
}
}
-impl Into<ProtocolError> for OpaqueError {
- fn into(self) -> ProtocolError {
- self.0
+impl From<OpaqueError> for ProtocolError {
+ fn from(value: OpaqueError) -> Self {
+ value.0
}
}
diff --git a/shared/comm-opaque2/src/lib.rs b/shared/comm-opaque2/src/lib.rs
--- a/shared/comm-opaque2/src/lib.rs
+++ b/shared/comm-opaque2/src/lib.rs
@@ -22,7 +22,7 @@
let mut client_register = client::Registration::new();
let client_message = client_register.start(pass).unwrap();
- let mut server_register = server::Registration::new();
+ let server_register = server::Registration::new();
let server_response = server_register
.start(&server_setup, &client_message, username.as_bytes())
.unwrap();
diff --git a/shared/comm-opaque2/src/server/login.rs b/shared/comm-opaque2/src/server/login.rs
--- a/shared/comm-opaque2/src/server/login.rs
+++ b/shared/comm-opaque2/src/server/login.rs
@@ -55,12 +55,15 @@
let finalization_payload =
CredentialFinalization::deserialize(response_payload)?;
- let state = self
- .state
- .take()
- .ok_or_else(|| ProtocolError::InvalidLoginError)?;
+ let state = self.state.take().ok_or(ProtocolError::InvalidLoginError)?;
let result = state.finish(finalization_payload)?;
self.session_key = Some(result.session_key.to_vec());
Ok(())
}
}
+
+impl Default for Login {
+ fn default() -> Self {
+ Self::new()
+ }
+}
diff --git a/shared/comm-opaque2/src/server/register.rs b/shared/comm-opaque2/src/server/register.rs
--- a/shared/comm-opaque2/src/server/register.rs
+++ b/shared/comm-opaque2/src/server/register.rs
@@ -38,3 +38,9 @@
)
}
}
+
+impl Default for Registration {
+ fn default() -> Self {
+ Self::new()
+ }
+}

File Metadata

Mime Type
text/plain
Expires
Mon, Dec 23, 8:26 AM (14 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2693332
Default Alt Text
D12175.id40724.diff (3 KB)

Event Timeline