Trait ClientHandshake

Source
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§

Source

type KeyType

The type for the onion key.

Source

type StateType

The type for the state that the client holds while waiting for a reply.

Source

type KeyGen

A type that is returned and used to generate session keys.x

Source

type ClientAuxData: ?Sized

Type of extra data sent from client (without forward secrecy).

Source

type ServerAuxData

Type of extra data returned by server (without forward secrecy).

Required Methods§

Source

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.

Source

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.

Implementors§