Compare commits

..

9 Commits

Author SHA1 Message Date
Avril d76b77fbf1
Fixed build fail with async feature.
3 years ago
Avril 903bfcd7c4
Added `from_parts()`, as counterpart to `into_parts()`.
3 years ago
Avril 0645e61590
Exposed `cha` module for keygen and `Crypter` creation.
3 years ago
Avril 73b83e4d5c
Whoops...
3 years ago
Avril d2db1f30df
Merge branch 'read-stream-wrapper-async'
3 years ago
Avril 28f36401ec
Merge branch 'read-stream-wrapper'
3 years ago
Avril e656f78a9a
Added `Source` and `AsyncSource`. All tests currently passing.
3 years ago
Avril 868c6d6c61
Added crate-level re-exports.
3 years ago
Avril 1feb9b209b
Added basic docs to `Source`.
3 years ago

@ -1,6 +1,6 @@
[package] [package]
name = "chacha20stream" name = "chacha20stream"
version = "1.2.0" version = "2.2.1"
keywords = ["chacha20_poly1305", "stream", "wrapper", "encryption", "decryption"] keywords = ["chacha20_poly1305", "stream", "wrapper", "encryption", "decryption"]
description = "A writable wrapper stream for encryption and decryption with the stream cipher chacha20_poly1305" description = "A writable wrapper stream for encryption and decryption with the stream cipher chacha20_poly1305"
homepage = "https://git.flanchan.moe/flanchan/chacha20stream" homepage = "https://git.flanchan.moe/flanchan/chacha20stream"

@ -57,7 +57,7 @@ mod private
} }
pub mod key; pub mod key;
mod cha; pub mod cha;
mod stream; mod stream;
mod bytes; mod bytes;

@ -144,6 +144,15 @@ where W: Write
{ {
(self.stream, self.crypter) (self.stream, self.crypter)
} }
/// Create a sink from a stream and a crypter
///
/// The counterpart to `into_parts()`.
#[inline] pub fn from_parts(stream: W, crypter: Crypter) -> Self
{
Self::new(stream, crypter)
}
} }

@ -242,6 +242,14 @@ where R: Read
{ {
(self.stream, self.crypter) (self.stream, self.crypter)
} }
/// Create a source from a stream and a crypter
///
/// The counterpart to `into_parts()`.
#[inline] pub fn from_parts(stream: R, crypter: Crypter) -> Self
{
Self::new(stream, crypter)
}
} }

@ -109,6 +109,14 @@ impl<W: AsyncWrite> Sink<W>
(self.stream, self.crypter) (self.stream, self.crypter)
} }
/// Create a sink from a stream and a crypter
///
/// The counterpart to `into_parts()`.
#[inline] pub fn from_parts(stream: W, crypter: Crypter) -> Self
{
Self::new(stream, crypter)
}
/// The crypter of this instance /// The crypter of this instance
#[inline] pub fn crypter(&self) -> &Crypter #[inline] pub fn crypter(&self) -> &Crypter
{ {

@ -74,6 +74,15 @@ impl<R: AsyncRead> Source<R>
(self.stream, self.crypter) (self.stream, self.crypter)
} }
/// Create a source from a stream and a crypter
///
/// The counterpart to `into_parts()`.
#[inline] pub fn from_parts(stream: R, crypter: Crypter) -> Self
{
Self::new(stream, crypter)
}
/// The crypter of this instance /// The crypter of this instance
#[inline] pub fn crypter(&self) -> &Crypter #[inline] pub fn crypter(&self) -> &Crypter
{ {

Loading…
Cancel
Save