Struct ssb_box_stream::Server [−][src]
Parameters to establish a secure connection as a server
let network_identifier = [0u8; 32]; let server_identity = sodiumoxide::crypto::sign::gen_keypair(); let server = Server::new( &network_identifier, &server_identity.0, &server_identity.1, ); let mut listener = async_std::net::TcpListener::bind("localhost:5555").await.unwrap(); let (stream, _) = listener.accept().await?; let (send, recv, client_key) = server.accept(stream).await?;
Implementations
impl Server
[src]
pub fn new(
network_identifier: &[u8; 32],
identity_pk: &PublicKey,
identity_sk: &SecretKey
) -> Self
[src]
network_identifier: &[u8; 32],
identity_pk: &PublicKey,
identity_sk: &SecretKey
) -> Self
pub async fn accept<Stream: AsyncRead + AsyncWrite + Unpin>(
&self,
stream: Stream
) -> Result<(Encrypt<WriteHalf<Stream>>, Decrypt<ReadHalf<Stream>>, PublicKey), Error>
[src]
&self,
stream: Stream
) -> Result<(Encrypt<WriteHalf<Stream>>, Decrypt<ReadHalf<Stream>>, PublicKey), Error>
Execute the handshake protocol for the server and return the encrypted connection and the clients public identity key
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Server
[src]
impl Send for Server
[src]
impl Sync for Server
[src]
impl Unpin for Server
[src]
impl UnwindSafe for Server
[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>,