Skip to content

Commit

Permalink
[FIX] Loosen "version" restriction on PresentationRequestPayload (#1212)
Browse files Browse the repository at this point in the history
* impl fix

Signed-off-by: George Mulhearn <[email protected]>

* re-trigger pipeline

Signed-off-by: George Mulhearn <[email protected]>

---------

Signed-off-by: George Mulhearn <[email protected]>
  • Loading branch information
gmulhearn-anonyome authored Jun 10, 2024
1 parent bd8bc8a commit f0c8184
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl HarnessAgent {
let id = self
.aries_agent
.verifier()
.send_proof_request(&presentation_request.connection_id, request.into(), None)
.send_proof_request(&presentation_request.connection_id, request.into_v1(), None)
.await?;
let state = self.aries_agent.verifier().get_state(&id)?;
Ok(json!({ "state": to_backchannel_state_verifier(state), "thread_id": id }).to_string())
Expand Down
6 changes: 3 additions & 3 deletions aries/aries_vcx/tests/test_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ async fn test_pool_proof_self_attested_proof_validation() -> Result<(), Box<dyn
let prover_proof_json = anoncreds
.prover_create_proof(
&setup.wallet,
proof_req_json.into(),
proof_req_json.into_v1(),
RequestedCredentials {
self_attested_attributes: vec![
(
Expand Down Expand Up @@ -451,7 +451,7 @@ async fn test_pool_proof_restrictions() -> Result<(), Box<dyn Error>> {
let prover_proof_json = anoncreds
.prover_create_proof(
&setup.wallet,
proof_req_json.into(),
proof_req_json.into_v1(),
RequestedCredentials {
self_attested_attributes: vec![(
"attribute_2".to_string(),
Expand Down Expand Up @@ -563,7 +563,7 @@ async fn test_pool_proof_validate_attribute() -> Result<(), Box<dyn Error>> {
let prover_proof_json = anoncreds
.prover_create_proof(
&setup.wallet,
proof_req_json.into(),
proof_req_json.into_v1(),
RequestedCredentials {
self_attested_attributes: vec![(
"attribute_2".to_string(),
Expand Down
4 changes: 2 additions & 2 deletions aries/aries_vcx/tests/utils/scenarios/proof_presentation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ pub async fn accept_proof_proposal(
.nonce(Nonce::new().unwrap())
.build();
verifier
.set_presentation_request(presentation_request.into(), None)
.set_presentation_request(presentation_request.into_v1(), None)
.unwrap();
verifier.mark_presentation_request_sent().unwrap()
}
Expand Down Expand Up @@ -159,7 +159,7 @@ pub async fn create_proof_request_data(
.requested_predicates(requested_preds)
.non_revoked(Some(revocation_interval))
.build()
.into()
.into_v1()
}

pub async fn create_prover_from_request(presentation_request: RequestPresentationV1) -> Prover {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use crate::{
pub struct PresentationRequestPayload {
pub nonce: Nonce,
pub name: String,
#[builder(default)]
pub version: PresentationRequestVersion,
#[builder(default = String::from("1.0"))]
pub version: String,
#[serde(default)]
#[builder(default)]
pub requested_attributes: HashMap<String, AttributeInfo>,
Expand All @@ -34,12 +34,12 @@ pub struct PresentationRequestPayload {
pub non_revoked: Option<NonRevokedInterval>,
}

impl From<PresentationRequestPayload> for PresentationRequest {
fn from(value: PresentationRequestPayload) -> Self {
match value.version {
PresentationRequestVersion::V1 => Self::PresentationRequestV1(value),
PresentationRequestVersion::V2 => Self::PresentationRequestV2(value),
}
impl PresentationRequestPayload {
pub fn into_v1(self) -> PresentationRequest {
PresentationRequest::PresentationRequestV1(self)
}
pub fn into_v2(self) -> PresentationRequest {
PresentationRequest::PresentationRequestV2(self)
}
}

Expand Down

0 comments on commit f0c8184

Please sign in to comment.