pub(crate) trait ClientHandshake {
type KeyType;
type StateType;
type KeyGen;
type ClientAuxData: ?Sized;
type ServerAuxData;
// Required methods
fn client1<R: RngCore + CryptoRng, M: Borrow<Self::ClientAuxData>>(
rng: &mut R,
key: &Self::KeyType,
client_aux_data: &M,
) -> Result<(Self::StateType, Vec<u8>)>;
fn client2<T: AsRef<[u8]>>(
state: Self::StateType,
msg: T,
) -> Result<(Self::ServerAuxData, Self::KeyGen)>;
}
Expand description
A ClientHandshake is used to generate a client onionskin and handle a relay onionskin.
Required Associated Types§
Sourcetype ClientAuxData: ?Sized
type ClientAuxData: ?Sized
Type of extra data sent from client (without forward secrecy).
Sourcetype ServerAuxData
type ServerAuxData
Type of extra data returned by server (without forward secrecy).
Required Methods§
Sourcefn client1<R: RngCore + CryptoRng, M: Borrow<Self::ClientAuxData>>(
rng: &mut R,
key: &Self::KeyType,
client_aux_data: &M,
) -> Result<(Self::StateType, Vec<u8>)>
fn client1<R: RngCore + CryptoRng, M: Borrow<Self::ClientAuxData>>( rng: &mut R, key: &Self::KeyType, client_aux_data: &M, ) -> Result<(Self::StateType, Vec<u8>)>
Generate a new client onionskin for a relay with a given onion key,
including client_aux_data
to be sent without forward secrecy.
On success, return a state object that will be used to complete the handshake, along with the message to send.
Sourcefn client2<T: AsRef<[u8]>>(
state: Self::StateType,
msg: T,
) -> Result<(Self::ServerAuxData, Self::KeyGen)>
fn client2<T: AsRef<[u8]>>( state: Self::StateType, msg: T, ) -> Result<(Self::ServerAuxData, Self::KeyGen)>
Handle an onionskin from a relay, and produce aux data returned from the server, and a key generator.
The state object must match the one that was used to make the client onionskin that the server is replying to.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.