diff --git a/http-signature-normalization-reqwest/Cargo.toml b/http-signature-normalization-reqwest/Cargo.toml index a2295a3..7cc890c 100644 --- a/http-signature-normalization-reqwest/Cargo.toml +++ b/http-signature-normalization-reqwest/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "http-signature-normalization-reqwest" description = "An HTTP Signatures library that leaves the signing to you" -version = "0.5.0" +version = "0.6.0" authors = ["asonix "] license-file = "LICENSE" readme = "README.md" @@ -31,9 +31,14 @@ reqwest-middleware = { version = "0.1.2", optional = true } sha2 = { version = "0.10", optional = true } sha3 = { version = "0.10", optional = true } thiserror = "1.0" -tokio = { version = "1", default-features = false, features = ["rt"], optional = true } +tokio = { version = "1", default-features = false, features = [ + "rt", +], optional = true } [dev-dependencies] httpdate = "1.0.2" pretty_env_logger = "0.4" -tokio = { version = "1", default-features = false, features = ["rt-multi-thread", "macros"] } +tokio = { version = "1", default-features = false, features = [ + "rt-multi-thread", + "macros", +] } diff --git a/http-signature-normalization-reqwest/examples/client.rs b/http-signature-normalization-reqwest/examples/client.rs index 79f92fd..2670a0b 100644 --- a/http-signature-normalization-reqwest/examples/client.rs +++ b/http-signature-normalization-reqwest/examples/client.rs @@ -5,7 +5,7 @@ use httpdate::HttpDate; use reqwest::{header::DATE, Client}; use sha2::{Digest, Sha256}; -async fn request(config: Config) -> Result<(), Box> { +async fn request(config: Config) -> Result<(), Box> { let digest = Sha256::new(); let client = Client::new(); @@ -28,15 +28,17 @@ async fn request(config: Config) -> Result<(), Box> { } #[tokio::main] -async fn main() -> Result<(), Box> { +async fn main() -> Result<(), Box> { std::env::set_var("RUST_LOG", "info"); pretty_env_logger::init(); - let config = Config::default().require_header("accept"); + tokio::spawn(async move { + let config = Config::default().require_header("accept"); - request(config.clone()).await?; - request(config.mastodon_compat()).await?; - Ok(()) + request(config.clone()).await?; + request(config.mastodon_compat()).await + }) + .await? } #[derive(Debug, thiserror::Error)] diff --git a/http-signature-normalization-reqwest/src/digest/mod.rs b/http-signature-normalization-reqwest/src/digest/mod.rs index 7a08f4b..8fab0f4 100644 --- a/http-signature-normalization-reqwest/src/digest/mod.rs +++ b/http-signature-normalization-reqwest/src/digest/mod.rs @@ -29,11 +29,11 @@ pub trait SignExt: Sign { digest: D, v: V, f: F, - ) -> Pin>>> + ) -> Pin> + Send>> where F: FnOnce(&str) -> Result + Send + 'static, E: From + From, - K: Display + 'static, + K: Display + Send + 'static, D: DigestCreate + Send + 'static, V: AsRef<[u8]> + Into + Send + 'static, Self: Sized; @@ -45,11 +45,11 @@ pub trait SignExt: Sign { digest: D, v: V, f: F, - ) -> Pin>>> + ) -> Pin> + Send>> where F: FnOnce(&str) -> Result + Send + 'static, E: From + From, - K: Display + 'static, + K: Display + Send + 'static, D: DigestCreate + Send + 'static, V: AsRef<[u8]> + Into + Send + 'static, Self: Sized; @@ -63,11 +63,11 @@ impl SignExt for RequestBuilder { mut digest: D, v: V, f: F, - ) -> Pin>>> + ) -> Pin> + Send>> where F: FnOnce(&str) -> Result + Send + 'static, E: From + From, - K: Display + 'static, + K: Display + Send + 'static, D: DigestCreate + Send + 'static, V: AsRef<[u8]> + Into + Send + 'static, Self: Sized, @@ -97,11 +97,11 @@ impl SignExt for RequestBuilder { mut digest: D, v: V, f: F, - ) -> Pin>>> + ) -> Pin> + Send>> where F: FnOnce(&str) -> Result + Send + 'static, E: From + From, - K: Display + 'static, + K: Display + Send + 'static, D: DigestCreate + Send + 'static, V: AsRef<[u8]> + Into + Send + 'static, Self: Sized, @@ -140,11 +140,11 @@ mod middleware { mut digest: D, v: V, f: F, - ) -> Pin>>> + ) -> Pin> + Send>> where F: FnOnce(&str) -> Result + Send + 'static, E: From + From, - K: Display + 'static, + K: Display + Send + 'static, D: DigestCreate + Send + 'static, V: AsRef<[u8]> + Into + Send + 'static, Self: Sized, @@ -174,11 +174,11 @@ mod middleware { mut digest: D, v: V, f: F, - ) -> Pin>>> + ) -> Pin> + Send>> where F: FnOnce(&str) -> Result + Send + 'static, E: From + From, - K: Display + 'static, + K: Display + Send + 'static, D: DigestCreate + Send + 'static, V: AsRef<[u8]> + Into + Send + 'static, Self: Sized,