diff --git a/Cargo.lock b/Cargo.lock index 9deb4336..ad64e523 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -120,7 +120,7 @@ dependencies = [ [[package]] name = "bromine" -version = "0.20.0" +version = "0.20.1" dependencies = [ "async-trait", "bincode", diff --git a/Cargo.toml b/Cargo.toml index 1c72b631..09f447ff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bromine" -version = "0.20.0" +version = "0.20.1" authors = ["trivernis "] edition = "2018" readme = "README.md" @@ -28,15 +28,15 @@ async-trait = "0.1.52" num_enum = "0.5.7" futures-core = "0.3.21" trait-bound-typemap = "0.3.3" +bytes = "1.1.0" rmp-serde = { version = "1.0.0", optional = true } bincode = { version = "1.3.3", optional = true } serde_json = { version = "1.0.79", optional = true } -bytes = "1.1.0" -chacha20poly1305 = "0.9.0" -x25519-dalek = "1.2.0" -rand = "0.8.5" -rand_core = "0.6.3" -sha2 = "0.10.2" +chacha20poly1305 = {version = "0.9.0", optional = true} +x25519-dalek = {version = "1.2.0", optional = true} +rand = {version = "0.8.5", optional = true} +rand_core = {version = "0.6.3", optional = true} +sha2 = {version = "0.10.2", optional = true} [dependencies.serde] optional = true @@ -73,6 +73,7 @@ features = ["macros", "rt-multi-thread"] [features] default = [] +encryption_layer = ["chacha20poly1305", "sha2", "rand", "x25519-dalek", "rand_core"] serialize = ["serde"] serialize_rmp = ["serialize", "rmp-serde"] serialize_bincode = ["serialize", "bincode"] diff --git a/src/protocol/encrypted/mod.rs b/src/protocol/encrypted/mod.rs index dc130ec8..b7eb4675 100644 --- a/src/protocol/encrypted/mod.rs +++ b/src/protocol/encrypted/mod.rs @@ -5,7 +5,7 @@ mod protocol_impl; use bytes::{BufMut, Bytes, BytesMut}; pub use io_impl::*; pub use protocol_impl::*; -use rand_core::RngCore; +use rand::RngCore; use std::future::Future; use std::io; use std::pin::Pin; diff --git a/src/protocol/mod.rs b/src/protocol/mod.rs index 2792fb6f..c65d4d87 100644 --- a/src/protocol/mod.rs +++ b/src/protocol/mod.rs @@ -1,5 +1,6 @@ pub mod tcp; +#[cfg(feature = "encryption_layer")] pub mod encrypted; #[cfg(unix)] pub mod unix_socket; diff --git a/tests/test_encryption.rs b/tests/test_encryption.rs index 24eeddea..1bfa5ea7 100644 --- a/tests/test_encryption.rs +++ b/tests/test_encryption.rs @@ -1,3 +1,4 @@ +#![cfg(feature = "encryption_layer")] use crate::utils::call_counter::increment_counter_for_event; use crate::utils::protocol::TestProtocolListener; use crate::utils::{get_free_port, start_server_and_client};