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