Compare commits

...

4 commits

Author SHA1 Message Date
asonix 3d7b620bc0 actix: update version to 0.11.1 2024-04-14 20:24:21 -05:00
asonix 07413815d5 actix: Update base64 2024-04-14 20:23:46 -05:00
asonix c38072e65d Update reqwest to 0.12 2024-04-14 20:19:19 -05:00
asonix 47d28c6f47 Update ring, base64 2023-11-25 19:52:55 -06:00
8 changed files with 21 additions and 14 deletions

View file

@ -1,7 +1,7 @@
[package] [package]
name = "http-signature-normalization-actix" name = "http-signature-normalization-actix"
description = "An HTTP Signatures library that leaves the signing to you" description = "An HTTP Signatures library that leaves the signing to you"
version = "0.11.0" version = "0.11.1"
authors = ["asonix <asonix@asonix.dog>"] authors = ["asonix <asonix@asonix.dog>"]
license = "AGPL-3.0" license = "AGPL-3.0"
readme = "README.md" readme = "README.md"
@ -32,7 +32,7 @@ actix-http = { version = "3.0.2", default-features = false }
actix-rt = "2.6.0" actix-rt = "2.6.0"
actix-web = { version = "4.0.0", default-features = false, optional = true } actix-web = { version = "4.0.0", default-features = false, optional = true }
awc = { version = "3.0.0", default-features = false, optional = true } awc = { version = "3.0.0", default-features = false, optional = true }
base64 = { version = "0.21", optional = true } base64 = { version = "0.22", optional = true }
futures-core = "0.3.28" futures-core = "0.3.28"
http-signature-normalization = { version = "0.7.0", path = ".." } http-signature-normalization = { version = "0.7.0", path = ".." }
ring = { version = "0.17.5", optional = true } ring = { version = "0.17.5", optional = true }

View file

@ -1,5 +1,6 @@
use actix_rt::task::JoinError; use actix_rt::task::JoinError;
use awc::Client; use awc::Client;
use base64::{engine::general_purpose::STANDARD, Engine};
use http_signature_normalization_actix::{digest::ring::Sha256, prelude::*, Canceled}; use http_signature_normalization_actix::{digest::ring::Sha256, prelude::*, Canceled};
use tracing::{error, info}; use tracing::{error, info};
use tracing_error::ErrorLayer; use tracing_error::ErrorLayer;
@ -14,7 +15,7 @@ async fn request(config: Config) -> Result<(), Box<dyn std::error::Error>> {
.append_header(("Accept", "text/plain")) .append_header(("Accept", "text/plain"))
.signature_with_digest(config, "my-key-id", digest, "Hewwo-owo", |s| { .signature_with_digest(config, "my-key-id", digest, "Hewwo-owo", |s| {
info!("Signing String\n{}", s); info!("Signing String\n{}", s);
Ok(base64::encode(s)) as Result<_, MyError> Ok(STANDARD.encode(s)) as Result<_, MyError>
}) })
.await? .await?
.send() .send()

View file

@ -1,4 +1,5 @@
use actix_web::{http::StatusCode, web, App, HttpRequest, HttpResponse, HttpServer, ResponseError}; use actix_web::{http::StatusCode, web, App, HttpRequest, HttpResponse, HttpServer, ResponseError};
use base64::{engine::general_purpose::STANDARD, Engine};
use http_signature_normalization_actix::{digest::ring::Sha256, prelude::*}; use http_signature_normalization_actix::{digest::ring::Sha256, prelude::*};
use std::future::{ready, Ready}; use std::future::{ready, Ready};
use tracing::info; use tracing::info;
@ -29,7 +30,7 @@ impl SignatureVerify for MyVerify {
return ready(Err(MyError::Key)); return ready(Err(MyError::Key));
} }
let decoded = match base64::decode(&signature) { let decoded = match STANDARD.decode(&signature) {
Ok(decoded) => decoded, Ok(decoded) => decoded,
Err(_) => return ready(Err(MyError::Decode)), Err(_) => return ready(Err(MyError::Decode)),
}; };

View file

@ -1,7 +1,7 @@
[package] [package]
name = "http-signature-normalization-reqwest" name = "http-signature-normalization-reqwest"
description = "An HTTP Signatures library that leaves the signing to you" description = "An HTTP Signatures library that leaves the signing to you"
version = "0.10.0" version = "0.12.0"
authors = ["asonix <asonix@asonix.dog>"] authors = ["asonix <asonix@asonix.dog>"]
license = "AGPL-3.0" license = "AGPL-3.0"
readme = "README.md" readme = "README.md"
@ -25,12 +25,12 @@ required-features = ["default-spawner", "ring"]
[dependencies] [dependencies]
async-trait = "0.1.71" async-trait = "0.1.71"
base64 = { version = "0.13", optional = true } base64 = { version = "0.22", optional = true }
http-signature-normalization = { version = "0.7.0", path = ".." } http-signature-normalization = { version = "0.7.0", path = ".." }
httpdate = "1.0.2" httpdate = "1.0.2"
reqwest = { version = "0.11", default-features = false, features = ["json"] } reqwest = { version = "0.12", default-features = false, features = ["json"] }
reqwest-middleware = { version = "0.2.0", optional = true } reqwest-middleware = { version = "0.3.0", optional = true }
ring = { version = "0.16.20", optional = true } ring = { version = "0.17.5", optional = true }
sha2 = { version = "0.10", optional = true } sha2 = { version = "0.10", optional = true }
sha3 = { version = "0.10", optional = true } sha3 = { version = "0.10", optional = true }
thiserror = "1.0" thiserror = "1.0"
@ -39,7 +39,7 @@ tokio = { version = "1", default-features = false, features = [
], optional = true } ], optional = true }
[dev-dependencies] [dev-dependencies]
pretty_env_logger = "0.4" pretty_env_logger = "0.5"
tokio = { version = "1", default-features = false, features = [ tokio = { version = "1", default-features = false, features = [
"rt-multi-thread", "rt-multi-thread",
"macros", "macros",

View file

@ -1,3 +1,4 @@
use base64::{engine::general_purpose::STANDARD, Engine};
use http_signature_normalization_reqwest::{digest::ring::Sha256, prelude::*}; use http_signature_normalization_reqwest::{digest::ring::Sha256, prelude::*};
use reqwest::{ use reqwest::{
header::{ACCEPT, USER_AGENT}, header::{ACCEPT, USER_AGENT},
@ -15,7 +16,7 @@ async fn request(config: Config) -> Result<(), Box<dyn std::error::Error + Send
.header(ACCEPT, "text/plain") .header(ACCEPT, "text/plain")
.signature_with_digest(config, "my-key-id", digest, "Hewwo-owo", |s| { .signature_with_digest(config, "my-key-id", digest, "Hewwo-owo", |s| {
println!("Signing String\n{}", s); println!("Signing String\n{}", s);
Ok(base64::encode(s)) as Result<_, MyError> Ok(STANDARD.encode(s)) as Result<_, MyError>
}) })
.await?; .await?;

View file

@ -81,9 +81,11 @@ impl Default for Sha512 {
} }
fn create(mut context: ring::digest::Context, input: &[u8]) -> String { fn create(mut context: ring::digest::Context, input: &[u8]) -> String {
use base64::prelude::*;
context.update(input); context.update(input);
let digest = context.finish(); let digest = context.finish();
base64::encode(digest.as_ref()) BASE64_STANDARD.encode(digest.as_ref())
} }
impl DigestCreate for Sha256 { impl DigestCreate for Sha256 {

View file

@ -1,3 +1,4 @@
use base64::prelude::*;
use sha2::{Sha224, Sha256, Sha384, Sha512}; use sha2::{Sha224, Sha256, Sha384, Sha512};
use super::DigestCreate; use super::DigestCreate;
@ -7,7 +8,7 @@ fn create<D: sha2::Digest + sha2::digest::FixedOutputReset>(
input: &[u8], input: &[u8],
) -> String { ) -> String {
sha2::Digest::update(digest, input); sha2::Digest::update(digest, input);
base64::encode(&digest.finalize_reset()) BASE64_STANDARD.encode(&digest.finalize_reset())
} }
impl DigestCreate for Sha224 { impl DigestCreate for Sha224 {

View file

@ -1,3 +1,4 @@
use base64::prelude::*;
use sha3::{ use sha3::{
Keccak224, Keccak256, Keccak256Full, Keccak384, Keccak512, Sha3_224, Sha3_256, Sha3_384, Keccak224, Keccak256, Keccak256Full, Keccak384, Keccak512, Sha3_224, Sha3_256, Sha3_384,
Sha3_512, Sha3_512,
@ -10,7 +11,7 @@ fn create<D: sha3::Digest + sha3::digest::FixedOutputReset>(
input: &[u8], input: &[u8],
) -> String { ) -> String {
sha3::Digest::update(digest, input); sha3::Digest::update(digest, input);
base64::encode(&digest.finalize_reset()) BASE64_STANDARD.encode(&digest.finalize_reset())
} }
impl DigestCreate for Sha3_224 { impl DigestCreate for Sha3_224 {