From 07413815d5a4c4abcb082d5c42a42dea8f3e1a88 Mon Sep 17 00:00:00 2001 From: asonix Date: Sun, 14 Apr 2024 20:23:46 -0500 Subject: [PATCH] actix: Update base64 --- actix/Cargo.toml | 2 +- actix/examples/client.rs | 3 ++- actix/examples/server.rs | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/actix/Cargo.toml b/actix/Cargo.toml index 98defa7..ba40117 100644 --- a/actix/Cargo.toml +++ b/actix/Cargo.toml @@ -32,7 +32,7 @@ actix-http = { version = "3.0.2", default-features = false } actix-rt = "2.6.0" actix-web = { version = "4.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" http-signature-normalization = { version = "0.7.0", path = ".." } ring = { version = "0.17.5", optional = true } diff --git a/actix/examples/client.rs b/actix/examples/client.rs index bf380fa..2967b4c 100644 --- a/actix/examples/client.rs +++ b/actix/examples/client.rs @@ -1,5 +1,6 @@ use actix_rt::task::JoinError; use awc::Client; +use base64::{engine::general_purpose::STANDARD, Engine}; use http_signature_normalization_actix::{digest::ring::Sha256, prelude::*, Canceled}; use tracing::{error, info}; use tracing_error::ErrorLayer; @@ -14,7 +15,7 @@ async fn request(config: Config) -> Result<(), Box> { .append_header(("Accept", "text/plain")) .signature_with_digest(config, "my-key-id", digest, "Hewwo-owo", |s| { info!("Signing String\n{}", s); - Ok(base64::encode(s)) as Result<_, MyError> + Ok(STANDARD.encode(s)) as Result<_, MyError> }) .await? .send() diff --git a/actix/examples/server.rs b/actix/examples/server.rs index 3bb46da..e4fadd9 100644 --- a/actix/examples/server.rs +++ b/actix/examples/server.rs @@ -1,4 +1,5 @@ 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 std::future::{ready, Ready}; use tracing::info; @@ -29,7 +30,7 @@ impl SignatureVerify for MyVerify { return ready(Err(MyError::Key)); } - let decoded = match base64::decode(&signature) { + let decoded = match STANDARD.decode(&signature) { Ok(decoded) => decoded, Err(_) => return ready(Err(MyError::Decode)), };