Struct ssb_box_stream::Client[][src]

pub struct Client { /* fields omitted */ }

Parameters to establish a secure connection as a client

let network_identifier = [0u8; 32];
let server_identity_pk = sodiumoxide::crypto::sign::gen_keypair().0;
let client_identity = sodiumoxide::crypto::sign::gen_keypair();
let client = Client::new(
    &network_identifier,
    &server_identity_pk,
    &client_identity.0,
    &client_identity.1,
);

let mut stream = async_std::net::TcpStream::connect("localhost:5555").await.unwrap();
let (send, recv) = client.connect(stream).await?;

Implementations

impl Client[src]

pub fn new(
    network_identifier: &[u8; 32],
    server_identity_pk: &PublicKey,
    identity_pk: &PublicKey,
    identity_sk: &SecretKey
) -> Self
[src]

pub async fn connect<Stream: AsyncWrite + AsyncRead + Unpin>(
    &self,
    stream: Stream
) -> Result<(Encrypt<WriteHalf<Stream>>, Decrypt<ReadHalf<Stream>>), Error>
[src]

Execute the handshake protocol for the client and return the encrypted connection.

Trait Implementations

impl Clone for Client[src]

impl Debug for Client[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.