reqwest: update to new api

This commit is contained in:
Aode (lion) 2021-11-29 16:06:31 -06:00
parent b489a40344
commit 126ab4e925

View file

@ -3,10 +3,10 @@
#![deny(missing_docs)]
use apub_core::{
deliver::Deliver,
repo::{Dereference, Repo},
digest::{Digest, DigestBuilder, DigestFactory},
repo::{Dereference, Repo},
session::{Session, SessionError},
signature::{Sign, SignFactory},
signature::{PrivateKey, Sign},
};
use http_signature_normalization_reqwest::{
digest::{DigestCreate, SignExt},
@ -88,7 +88,7 @@ pub enum ReqwestError<E: std::error::Error + Send> {
SignatureError(#[from] SignatureError<E>),
}
type SignTraitError<S> = <<S as SignFactory>::Signer as Sign>::Error;
type SignTraitError<S> = <<S as PrivateKey>::Signer as Sign>::Error;
struct DigestWrapper<D>(D);
@ -105,7 +105,7 @@ where
impl<Crypto> ReqwestClient<Crypto>
where
Crypto: SignFactory,
Crypto: PrivateKey,
{
/// Create a new Client & Repo implementation backed by the reqwest client
pub fn new(client: Client, config: SignatureConfig, crypto: Crypto) -> Self {
@ -143,8 +143,7 @@ where
#[async_trait::async_trait(?Send)]
impl<Crypto> Repo for ReqwestClient<Crypto>
where
Crypto: SignFactory + Send + Sync,
<Crypto as SignFactory>::KeyId: Send,
Crypto: PrivateKey + Send + Sync,
{
type Error = ReqwestError<SignTraitError<Crypto>>;
@ -160,8 +159,7 @@ where
#[async_trait::async_trait(?Send)]
impl<Crypto> Deliver for ReqwestClient<Crypto>
where
Crypto: DigestFactory + SignFactory + Send + Sync,
<Crypto as SignFactory>::KeyId: Send,
Crypto: DigestFactory + PrivateKey + Send + Sync,
<Crypto as DigestFactory>::Digest: DigestBuilder + Clone,
{
type Error = ReqwestError<SignTraitError<Crypto>>;