@ -4,6 +4,12 @@ use tokio::io::{AsyncWrite, AsyncRead};
usestd::sync::Arc;
useopenssl::symm::Crypter;
usestd::{
pin::Pin,
task::{Poll,Context},
io,
};
usecrypt::{
RsaPublicKey,
RsaPrivateKey,
@ -30,6 +36,7 @@ where S: AsyncWrite
}
/// Readable half of `EncryptedStream`.
#[pin_project]
pubstructReadHalf<S>
whereS: AsyncRead
{
@ -38,7 +45,7 @@ where S: AsyncRead
/// chacha20_poly1305 decrypter for incoming reads from `S`
//TODO: chacha20stream: implement a read version of AsyncSink so we don't need to keep this?
cipher: Option<Crypter>,
backing_read: Box<S>,
#[pin]backing_read: Box<S>,
}
structReadWriteCombined<R,W>
@ -62,6 +69,8 @@ where R: AsyncRead,
}
//TODO: How do we use this with a single AsyncStream instead of requiring 2? Will we need to make our own Arc wrapper?? Ugh,, for now let's ignore this I guess... Most read+write thingies have a Read/WriteHalf split mechanism.
//
// Note that this does actually work fine with things like tokio's `duplex()` (i think)