diff --git a/http-signature-normalization-reqwest/Cargo.toml b/http-signature-normalization-reqwest/Cargo.toml index 8d88502..0c9d626 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.3.1" +version = "0.4.0" authors = ["asonix "] license-file = "LICENSE" readme = "README.md" @@ -29,8 +29,8 @@ http = "0.2.0" http-signature-normalization = { version = "0.5.1", path = ".." } reqwest = { version = "0.11", default-features = false, features = ["json"] } reqwest-middleware = { version = "0.1.2", optional = true } -sha2 = { version = "0.9", optional = true } -sha3 = { version = "0.9", 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 } diff --git a/http-signature-normalization-reqwest/src/digest/sha2.rs b/http-signature-normalization-reqwest/src/digest/sha2.rs index 42b3169..8b05711 100644 --- a/http-signature-normalization-reqwest/src/digest/sha2.rs +++ b/http-signature-normalization-reqwest/src/digest/sha2.rs @@ -1,9 +1,12 @@ -use sha2::{Sha224, Sha256, Sha384, Sha512, Sha512Trunc224, Sha512Trunc256}; +use sha2::{Sha224, Sha256, Sha384, Sha512}; use super::DigestCreate; -fn create(digest: &mut impl sha2::Digest, input: &[u8]) -> String { - digest.update(input); +fn create( + digest: &mut D, + input: &[u8], +) -> String { + sha2::Digest::update(digest, input); base64::encode(&digest.finalize_reset()) } @@ -38,19 +41,3 @@ impl DigestCreate for Sha512 { create(self, input) } } - -impl DigestCreate for Sha512Trunc224 { - const NAME: &'static str = "SHA-512-224"; - - fn compute(&mut self, input: &[u8]) -> String { - create(self, input) - } -} - -impl DigestCreate for Sha512Trunc256 { - const NAME: &'static str = "SHA-512-256"; - - fn compute(&mut self, input: &[u8]) -> String { - create(self, input) - } -} diff --git a/http-signature-normalization-reqwest/src/digest/sha3.rs b/http-signature-normalization-reqwest/src/digest/sha3.rs index dfb6dee..cdd3bca 100644 --- a/http-signature-normalization-reqwest/src/digest/sha3.rs +++ b/http-signature-normalization-reqwest/src/digest/sha3.rs @@ -5,8 +5,11 @@ use sha3::{ use super::DigestCreate; -fn create(digest: &mut impl sha3::Digest, input: &[u8]) -> String { - digest.update(input); +fn create( + digest: &mut D, + input: &[u8], +) -> String { + sha3::Digest::update(digest, input); base64::encode(&digest.finalize_reset()) }