Skip to content

Commit f0c8184

Browse files
[FIX] Loosen "version" restriction on PresentationRequestPayload (#1212)
* impl fix Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> * re-trigger pipeline Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> --------- Signed-off-by: George Mulhearn <gmulhearn@anonyome.com>
1 parent bd8bc8a commit f0c8184

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

aries/agents/aath-backchannel/src/controllers/presentation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl HarnessAgent {
106106
let id = self
107107
.aries_agent
108108
.verifier()
109-
.send_proof_request(&presentation_request.connection_id, request.into(), None)
109+
.send_proof_request(&presentation_request.connection_id, request.into_v1(), None)
110110
.await?;
111111
let state = self.aries_agent.verifier().get_state(&id)?;
112112
Ok(json!({ "state": to_backchannel_state_verifier(state), "thread_id": id }).to_string())

aries/aries_vcx/tests/test_verifier.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ async fn test_pool_proof_self_attested_proof_validation() -> Result<(), Box<dyn
361361
let prover_proof_json = anoncreds
362362
.prover_create_proof(
363363
&setup.wallet,
364-
proof_req_json.into(),
364+
proof_req_json.into_v1(),
365365
RequestedCredentials {
366366
self_attested_attributes: vec![
367367
(
@@ -451,7 +451,7 @@ async fn test_pool_proof_restrictions() -> Result<(), Box<dyn Error>> {
451451
let prover_proof_json = anoncreds
452452
.prover_create_proof(
453453
&setup.wallet,
454-
proof_req_json.into(),
454+
proof_req_json.into_v1(),
455455
RequestedCredentials {
456456
self_attested_attributes: vec![(
457457
"attribute_2".to_string(),
@@ -563,7 +563,7 @@ async fn test_pool_proof_validate_attribute() -> Result<(), Box<dyn Error>> {
563563
let prover_proof_json = anoncreds
564564
.prover_create_proof(
565565
&setup.wallet,
566-
proof_req_json.into(),
566+
proof_req_json.into_v1(),
567567
RequestedCredentials {
568568
self_attested_attributes: vec![(
569569
"attribute_2".to_string(),

aries/aries_vcx/tests/utils/scenarios/proof_presentation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ pub async fn accept_proof_proposal(
115115
.nonce(Nonce::new().unwrap())
116116
.build();
117117
verifier
118-
.set_presentation_request(presentation_request.into(), None)
118+
.set_presentation_request(presentation_request.into_v1(), None)
119119
.unwrap();
120120
verifier.mark_presentation_request_sent().unwrap()
121121
}
@@ -159,7 +159,7 @@ pub async fn create_proof_request_data(
159159
.requested_predicates(requested_preds)
160160
.non_revoked(Some(revocation_interval))
161161
.build()
162-
.into()
162+
.into_v1()
163163
}
164164

165165
pub async fn create_prover_from_request(presentation_request: RequestPresentationV1) -> Prover {

aries/misc/anoncreds_types/src/data_types/messages/pres_request.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ use crate::{
2121
pub struct PresentationRequestPayload {
2222
pub nonce: Nonce,
2323
pub name: String,
24-
#[builder(default)]
25-
pub version: PresentationRequestVersion,
24+
#[builder(default = String::from("1.0"))]
25+
pub version: String,
2626
#[serde(default)]
2727
#[builder(default)]
2828
pub requested_attributes: HashMap<String, AttributeInfo>,
@@ -34,12 +34,12 @@ pub struct PresentationRequestPayload {
3434
pub non_revoked: Option<NonRevokedInterval>,
3535
}
3636

37-
impl From<PresentationRequestPayload> for PresentationRequest {
38-
fn from(value: PresentationRequestPayload) -> Self {
39-
match value.version {
40-
PresentationRequestVersion::V1 => Self::PresentationRequestV1(value),
41-
PresentationRequestVersion::V2 => Self::PresentationRequestV2(value),
42-
}
37+
impl PresentationRequestPayload {
38+
pub fn into_v1(self) -> PresentationRequest {
39+
PresentationRequest::PresentationRequestV1(self)
40+
}
41+
pub fn into_v2(self) -> PresentationRequest {
42+
PresentationRequest::PresentationRequestV2(self)
4343
}
4444
}
4545

0 commit comments

Comments
 (0)