mirror of
https://git.asonix.dog/asonix/http-signature-normalization.git
synced 2024-11-25 02:41:00 +00:00
Update examples to use ring
This commit is contained in:
parent
ea964decc8
commit
8750783667
4 changed files with 13 additions and 6 deletions
|
@ -21,11 +21,11 @@ ring = ["digest", "dep:ring"]
|
|||
|
||||
[[example]]
|
||||
name = "server"
|
||||
required-features = ["server", "sha-2"]
|
||||
required-features = ["server", "ring"]
|
||||
|
||||
[[example]]
|
||||
name = "client"
|
||||
required-features = ["client", "sha-2"]
|
||||
required-features = ["client", "ring"]
|
||||
|
||||
[dependencies]
|
||||
actix-http = { version = "3.0.2", default-features = false }
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
use actix_rt::task::JoinError;
|
||||
use awc::Client;
|
||||
use http_signature_normalization_actix::prelude::*;
|
||||
use sha2::{Digest, Sha256};
|
||||
use http_signature_normalization_actix::{digest::ring::Sha256, prelude::*, Canceled};
|
||||
use tracing::{error, info};
|
||||
use tracing_error::ErrorLayer;
|
||||
use tracing_subscriber::{layer::SubscriberExt, EnvFilter};
|
||||
|
@ -75,3 +74,9 @@ impl From<JoinError> for MyError {
|
|||
MyError::Canceled
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Canceled> for MyError {
|
||||
fn from(_: Canceled) -> Self {
|
||||
MyError::Canceled
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use actix_web::{http::StatusCode, web, App, HttpRequest, HttpResponse, HttpServer, ResponseError};
|
||||
use http_signature_normalization_actix::prelude::*;
|
||||
use sha2::{Digest, Sha256};
|
||||
use http_signature_normalization_actix::{digest::ring::Sha256, prelude::*};
|
||||
use std::future::{ready, Ready};
|
||||
use tracing::info;
|
||||
use tracing_actix_web::TracingLogger;
|
||||
|
|
|
@ -3,16 +3,19 @@
|
|||
use crate::digest::DigestName;
|
||||
|
||||
/// A Sha256 digest backed by ring
|
||||
#[derive(Clone)]
|
||||
pub struct Sha256 {
|
||||
ctx: ring::digest::Context,
|
||||
}
|
||||
|
||||
/// A Sha384 digest backed by ring
|
||||
#[derive(Clone)]
|
||||
pub struct Sha384 {
|
||||
ctx: ring::digest::Context,
|
||||
}
|
||||
|
||||
/// A Sha512 digest backed by ring
|
||||
#[derive(Clone)]
|
||||
pub struct Sha512 {
|
||||
ctx: ring::digest::Context,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue