Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gm/fix proof req ver #5

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading