mirror of
https://git.asonix.dog/asonix/http-signature-normalization.git
synced 2024-11-22 01:11:00 +00:00
actix: Update base64
This commit is contained in:
parent
c38072e65d
commit
07413815d5
3 changed files with 5 additions and 3 deletions
|
@ -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 }
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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)),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue