From 4fdc58555850330c7e116960542c469c3c569f82 Mon Sep 17 00:00:00 2001 From: Florentin Dubois Date: Tue, 7 Mar 2023 11:26:54 +0100 Subject: [PATCH 1/2] Use rust-toolchain to ensure minimum rust version Signed-off-by: Florentin Dubois --- .github/workflows/ci.yml | 2 ++ rust-toolchain | 1 + 2 files changed, 3 insertions(+) create mode 100644 rust-toolchain diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 365523f..a343573 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,7 @@ jobs: fail-fast: true matrix: rust: + - 1.60.0 - stable - beta - nightly @@ -30,6 +31,7 @@ jobs: fail-fast: true matrix: rust: + - 1.60.0 - stable - beta - nightly diff --git a/rust-toolchain b/rust-toolchain new file mode 100644 index 0000000..4d5fde5 --- /dev/null +++ b/rust-toolchain @@ -0,0 +1 @@ +1.60.0 From 7cf6982333ef06ca522c0889c8fc142f23a91210 Mon Sep 17 00:00:00 2001 From: Florentin Dubois Date: Tue, 7 Mar 2023 11:30:49 +0100 Subject: [PATCH 2/2] Update dependencies * Bump async-trait to 0.1.66 * Bump base64 to 0.21.0 * Bump bytes to 1.4.0 * Bump hyper to 0.14.24 * Bump serde to 1.0.152 * Bump serde_json to 1.0.94 * Bump thiserror to 1.0.39 * Bump uuid to 1.3.0 Signed-off-by: Florentin Dubois --- Cargo.toml | 16 ++++++++-------- src/client/mod.rs | 21 +++++++++++---------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c4bbd2a..f81fd6e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,31 +19,31 @@ keywords = [ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -async-trait = { version = "^0.1.58", optional = true } -base64 = { version = "^0.13.1", optional = true } -bytes = { version = "^1.3.0", features = ["serde"], optional = true } +async-trait = { version = "^0.1.66", optional = true } +base64 = { version = "^0.21.0", optional = true } +bytes = { version = "^1.4.0", features = ["serde"], optional = true } cidr = { version = "^0.2.1", optional = true } crypto-common = { version = "^0.1.6", optional = true } headers = { version = "^0.3.8", optional = true } hmac = { version = "^0.12.1", features = ["std"], optional = true } -hyper = { version = "^0.14.23", default-features = false, optional = true } +hyper = { version = "^0.14.24", default-features = false, optional = true } hyper-tls = { version = "^0.5.0", optional = true } hyper-proxy = { version = "^0.9.1", default-features = false, features = ["tls"], optional = true } lazy_static = { version = "^1.4.0", optional = true } log = { version = "^0.4.17", optional = true } prometheus = { version = "^0.13.3", optional = true } -serde = { version = "^1.0.147", features = ["derive"], optional = true } -serde_json = { version = "^1.0.88", features = [ +serde = { version = "^1.0.152", features = ["derive"], optional = true } +serde_json = { version = "^1.0.94", features = [ "preserve_order", "float_roundtrip", ], optional = true } sha2 = { version = "^0.10.6", optional = true } -thiserror = { version = "^1.0.37", optional = true } +thiserror = { version = "^1.0.39", optional = true } tracing = { version = "^0.1.37", optional = true } tracing-futures = { version = "^0.2.5", optional = true } url = { version = "^2.3.1", default-features = false, features = ["serde"], optional = true } urlencoding = { version = "^2.1.2", optional = true } -uuid = { version = "^1.2.2", features = ["serde", "v4"], optional = true } +uuid = { version = "^1.3.0", features = ["serde", "v4"], optional = true } [features] default = ["client", "proxy", "logging"] diff --git a/src/client/mod.rs b/src/client/mod.rs index e2ba226..f008f83 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -15,6 +15,7 @@ use std::{ }; use async_trait::async_trait; +use base64::{engine::general_purpose::STANDARD as BASE64_ENGINE, Engine}; use bytes::Buf; use crypto_common::InvalidLength; use hmac::{Hmac, Mac}; @@ -242,15 +243,6 @@ impl OAuth1 for Signer { params } - #[cfg_attr(feature = "trace", tracing::instrument)] - fn signing_key(&self) -> String { - format!( - "{}&{}", - urlencoding::encode(&self.credentials.consumer_secret.to_owned()), - urlencoding::encode(&self.credentials.secret.to_owned()) - ) - } - #[cfg_attr(feature = "trace", tracing::instrument)] fn signature(&self, method: &str, endpoint: &str) -> Result { let (host, query) = match endpoint.find(|c| '?' == c) { @@ -294,7 +286,16 @@ impl OAuth1 for Signer { hasher.update(base.as_bytes()); let digest = hasher.finalize().into_bytes(); - Ok(base64::encode(digest.as_slice())) + Ok(BASE64_ENGINE.encode(digest.as_slice())) + } + + #[cfg_attr(feature = "trace", tracing::instrument)] + fn signing_key(&self) -> String { + format!( + "{}&{}", + urlencoding::encode(&self.credentials.consumer_secret.to_owned()), + urlencoding::encode(&self.credentials.secret.to_owned()) + ) } }