easy-srp 0.3.0

easy-srp wraps the rust srp crate and provides an easy to use API.
Documentation
//! Contains the four messages that client and server would exchange as part
//! of the SRP6a protocol. These messages are included for clarity and not
//! used directly by the `easy-srp` library.

use serde::{Deserialize, Serialize};

/// First message (from client to server)
/// 
/// Contains `username` and the ephemeral public key of the client
/// `client_public_key`.
#[derive(Debug, Clone)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct ClientServerMessage1 {
  pub username: String,
  #[serde(with = "crate::util::base64_vec_u8")]
  pub client_public_key: Vec<u8>,
}

/// Seconds message (from server to client)
/// 
/// Contains the `salt`` stored by the server and the server's ephermal
/// public key `server_public_key`
#[derive(Debug, Clone)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct ServerClientMessage2 {
  #[serde(with = "crate::util::base64_vec_u8")]
  pub salt: Vec<u8>,
  #[serde(with = "crate::util::base64_vec_u8")]
  pub server_public_key: Vec<u8>,
}

/// Third message (from client to server)
/// 
/// Contains the client's `client_proof`. The server must not send anything
/// encrypted by the common secret key before the client proof has been
/// verified.
#[derive(Debug, Clone)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct ClientServerMessage3 {
  #[serde(with = "crate::util::base64_vec_u8")]
  pub client_proof: Vec<u8>,
}

/// Forth message (from server to client)
/// 
/// Contains the server's `server_proof`. After verifying this proof, both
/// server and client may start using their common secret key.
#[derive(Debug, Clone)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct ServerClientMessage4 {
  #[serde(with = "crate::util::base64_vec_u8")]
  pub server_proof: Vec<u8>,
}