added serde support

ffi
Avril 3 years ago
parent 9333e994f2
commit d9dd56faf0
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -1,6 +1,6 @@
[package]
name = "chacha20stream"
version = "1.0.2"
version = "1.0.3"
keywords = ["chacha20_poly1305", "stream", "wrapper", "encryption", "decryption"]
description = "A writable wrapper stream for encryption and decryption with the stream cipher chacha20_poly1305"
homepage = "https://git.flanchan.moe/flanchan/chacha20stream"
@ -24,6 +24,7 @@ base64 = "0.13"
getrandom = "0.2"
openssl = "0.10"
pin-project = {version = "1.0.6", optional = true}
serde = {version = "1.0", features = ["derive"], optional = true}
smallvec = {version = "1.6", features=["union"], optional = true}
tokio = {version = "0.2", optional = true}
@ -32,4 +33,4 @@ rustc_version = "0.2"
[dev-dependencies]
tempfile = "3.2.0"
tokio = {version = "0.2", features=["full"]}
tokio = {version = "0.2", features=["full"]}

@ -40,6 +40,7 @@ use crate::ext::*;
/// assert_eq!(key_encoded.parse::<Key>().unwrap(), key);
/// ```
#[derive(Debug, Clone, PartialEq, Eq, Hash, Copy, Default)]
#[cfg_attr(feature="serde", derive(serde::Serialize, serde::Deserialize))]
#[repr(transparent)]
pub struct Key([u8; KEY_SIZE]);
@ -75,6 +76,7 @@ pub struct Key([u8; KEY_SIZE]);
/// assert_eq!(iv_encoded.parse::<IV>().unwrap(), iv);
/// ```
#[derive(Debug, Clone, PartialEq, Eq, Hash, Copy, Default)]
#[cfg_attr(feature="serde", derive(serde::Serialize, serde::Deserialize))]
#[repr(transparent)]
pub struct IV([u8; IV_SIZE]);

@ -36,6 +36,7 @@ fn decrypt_message_to<W: Write + ?Sized>(output: &mut W, encrypted: &[u8], key:
* **smallvec** - Use `smallvec` crate to store the in-memory buffer on the stack if it's smalle enough (*default*)
* **async** - Enable `AsyncSink` with tokio 0.2 `AsyncWrite`
* **explicit_clear** - Explicitly clear in-memory buffer after operations.
* **serde** - Enable `Key` and `IV` to be de/serialised with Serde.
*/
#![cfg_attr(nightly, feature(asm))]

Loading…
Cancel
Save