Implement serde serialization and deserialization to follow Rust's standards.

This commit is contained in:
Marcelin Dupraz
2021-06-12 23:24:27 -07:00
committed by Kevin Lewi
parent 940d1dcdb2
commit 055e76a115
6 changed files with 143 additions and 1 deletions
+9
View File
@@ -11,6 +11,7 @@ use crate::{
errors::{utils::check_slice_size_atleast, InternalPakeError, PakeError, ProtocolError},
group::Group,
hash::Hash,
impl_serialize_and_deserialize_for,
key_exchange::traits::{KeyExchange, ToBytesWithPointers},
keypair::{Key, KeyPair, SizedBytesExt},
map_to_curve::GroupWithMapToCurve,
@@ -83,6 +84,8 @@ impl<CS: CipherSuite> ClientRegistration<CS> {
}
}
impl_serialize_and_deserialize_for!(ClientRegistration);
/// Optional parameters for client registration finish
pub enum ClientRegistrationFinishParameters {
/// Specifying the identifiers idU and idS (corresponding to custom identifier mode)
@@ -385,6 +388,8 @@ impl<CS: CipherSuite> ServerRegistration<CS> {
}
}
impl_serialize_and_deserialize_for!(ServerRegistration);
// Login
// =====
@@ -454,6 +459,8 @@ impl<CS: CipherSuite> ClientLogin<CS> {
}
}
impl_serialize_and_deserialize_for!(ClientLogin);
/// Optional parameters for client login start
pub enum ClientLoginStartParameters {
/// Specifying a plaintext info field that will be sent to the server
@@ -880,6 +887,8 @@ impl<CS: CipherSuite> ServerLogin<CS> {
}
}
impl_serialize_and_deserialize_for!(ServerLogin);
// Zeroize on drop implementations
// This can't be derived because of the use of a phantom parameter