Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cobward committed Aug 1, 2024
1 parent 01b5b56 commit 26887a7
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 12 deletions.
2 changes: 0 additions & 2 deletions .cargo/config.toml

This file was deleted.

4 changes: 2 additions & 2 deletions src/core/authorization_request/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use self::{

use super::{
object::{ParsingErrorContext, UntypedObject},
util::{base_request, HttpClient},
util::{base_request, AsyncHttpClient},
};

pub mod parameters;
Expand Down Expand Up @@ -204,7 +204,7 @@ impl AuthorizationRequestObject {
&self.2
}

pub async fn resolve_presentation_definition<H: HttpClient>(
pub async fn resolve_presentation_definition<H: AsyncHttpClient>(
&self,
http_client: &H,
) -> Result<PresentationDefinition> {
Expand Down
4 changes: 2 additions & 2 deletions src/core/authorization_request/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::fmt;

use crate::core::{
object::{ParsingErrorContext, TypedParameter, UntypedObject},
util::{base_request, HttpClient},
util::{base_request, AsyncHttpClient},
};
use anyhow::{bail, Context, Error, Ok};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -130,7 +130,7 @@ impl ClientMetadata {
///
/// If the client metadata is not passed by reference or value if the Authorization Request Object,
/// then this function will return an error.
pub async fn resolve<H: HttpClient>(
pub async fn resolve<H: AsyncHttpClient>(
request: &AuthorizationRequestObject,
http_client: &H,
) -> Result<Self, Error> {
Expand Down
4 changes: 2 additions & 2 deletions src/core/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use http::{Request, Response};
///
/// A trait is used here so to facilitate native HTTP/TLS when compiled for mobile applications.
#[async_trait]
pub trait HttpClient {
pub trait AsyncHttpClient {
async fn execute(&self, request: Request<Vec<u8>>) -> Result<Response<Vec<u8>>>;
}

Expand All @@ -32,7 +32,7 @@ impl ReqwestClient {

#[cfg(feature = "reqwest")]
#[async_trait]
impl HttpClient for ReqwestClient {
impl AsyncHttpClient for ReqwestClient {
async fn execute(&self, request: Request<Vec<u8>>) -> Result<Response<Vec<u8>>> {
let response = self
.0
Expand Down
4 changes: 2 additions & 2 deletions src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ use crate::core::{
},
metadata::WalletMetadata,
response::{AuthorizationResponse, PostRedirection},
util::{base_request, HttpClient},
util::{base_request, AsyncHttpClient},
};

#[async_trait]
pub trait Wallet: RequestVerifier + Sync {
type HttpClient: HttpClient + Send + Sync;
type HttpClient: AsyncHttpClient + Send + Sync;

fn metadata(&self) -> &WalletMetadata;
fn http_client(&self) -> &Self::HttpClient;
Expand Down
4 changes: 2 additions & 2 deletions tests/jwt_vc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use oid4vp::{
},
metadata::WalletMetadata,
response::AuthorizationResponse,
util::HttpClient,
util::AsyncHttpClient,
},
verifier::{
request_signer::P256Signer,
Expand Down Expand Up @@ -137,7 +137,7 @@ impl RequestVerifier for JwtVcWallet {
}

#[async_trait]
impl HttpClient for MockHttpClient {
impl AsyncHttpClient for MockHttpClient {
async fn execute(&self, request: Request<Vec<u8>>) -> Result<Response<Vec<u8>>> {
// Only expect submission.
let body = request.body();
Expand Down

0 comments on commit 26887a7

Please sign in to comment.