From 213ee10b414ab30068c032319909b3328847e75a Mon Sep 17 00:00:00 2001 From: George Mulhearn Date: Wed, 5 Jun 2024 09:50:54 +1000 Subject: [PATCH 1/2] impl fix Signed-off-by: George Mulhearn --- .../src/controllers/presentation.rs | 2 +- aries/aries_vcx/tests/test_verifier.rs | 6 +++--- .../tests/utils/scenarios/proof_presentation.rs | 4 ++-- .../src/data_types/messages/pres_request.rs | 17 +++++++++-------- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/aries/agents/aath-backchannel/src/controllers/presentation.rs b/aries/agents/aath-backchannel/src/controllers/presentation.rs index 7afeb9b0d0..9ab73b146c 100644 --- a/aries/agents/aath-backchannel/src/controllers/presentation.rs +++ b/aries/agents/aath-backchannel/src/controllers/presentation.rs @@ -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()) diff --git a/aries/aries_vcx/tests/test_verifier.rs b/aries/aries_vcx/tests/test_verifier.rs index f0183f164f..47a566832f 100644 --- a/aries/aries_vcx/tests/test_verifier.rs +++ b/aries/aries_vcx/tests/test_verifier.rs @@ -361,7 +361,7 @@ async fn test_pool_proof_self_attested_proof_validation() -> Result<(), Box Result<(), Box> { 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(), @@ -563,7 +563,7 @@ async fn test_pool_proof_validate_attribute() -> Result<(), Box> { 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(), diff --git a/aries/aries_vcx/tests/utils/scenarios/proof_presentation.rs b/aries/aries_vcx/tests/utils/scenarios/proof_presentation.rs index e2043b5523..edad1f5729 100644 --- a/aries/aries_vcx/tests/utils/scenarios/proof_presentation.rs +++ b/aries/aries_vcx/tests/utils/scenarios/proof_presentation.rs @@ -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() } @@ -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 { diff --git a/aries/misc/anoncreds_types/src/data_types/messages/pres_request.rs b/aries/misc/anoncreds_types/src/data_types/messages/pres_request.rs index bc3704e44c..a81a03d86a 100644 --- a/aries/misc/anoncreds_types/src/data_types/messages/pres_request.rs +++ b/aries/misc/anoncreds_types/src/data_types/messages/pres_request.rs @@ -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, @@ -34,12 +34,13 @@ pub struct PresentationRequestPayload { pub non_revoked: Option, } -impl From 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) } } From 4292b922784c5d60785cc543221e04723a5d6e71 Mon Sep 17 00:00:00 2001 From: George Mulhearn Date: Thu, 6 Jun 2024 08:07:07 +1000 Subject: [PATCH 2/2] re-trigger pipeline Signed-off-by: George Mulhearn --- .../misc/anoncreds_types/src/data_types/messages/pres_request.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/aries/misc/anoncreds_types/src/data_types/messages/pres_request.rs b/aries/misc/anoncreds_types/src/data_types/messages/pres_request.rs index a81a03d86a..e43f0e0722 100644 --- a/aries/misc/anoncreds_types/src/data_types/messages/pres_request.rs +++ b/aries/misc/anoncreds_types/src/data_types/messages/pres_request.rs @@ -38,7 +38,6 @@ impl PresentationRequestPayload { pub fn into_v1(self) -> PresentationRequest { PresentationRequest::PresentationRequestV1(self) } - pub fn into_v2(self) -> PresentationRequest { PresentationRequest::PresentationRequestV2(self) }