Struct ssb_box_stream::Client [−][src]
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]
network_identifier: &[u8; 32],
server_identity_pk: &PublicKey,
identity_pk: &PublicKey,
identity_sk: &SecretKey
) -> Self
pub async fn connect<Stream: AsyncWrite + AsyncRead + Unpin>(
&self,
stream: Stream
) -> Result<(Encrypt<WriteHalf<Stream>>, Decrypt<ReadHalf<Stream>>), Error>
[src]
&self,
stream: Stream
) -> Result<(Encrypt<WriteHalf<Stream>>, Decrypt<ReadHalf<Stream>>), Error>
Execute the handshake protocol for the client and return the encrypted connection.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Client
[src]
impl Send for Client
[src]
impl Sync for Client
[src]
impl Unpin for Client
[src]
impl UnwindSafe for Client
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,