From 0a57d4dd7eea7ef92b8e8414fc651559a6365dcc Mon Sep 17 00:00:00 2001 From: bwty Date: Fri, 17 Feb 2023 13:22:05 -0800 Subject: [PATCH] fixes: PR fixes and rename test files Signed-off-by: bwty --- src/ffi/presentation.rs | 6 +++--- src/services/helpers.rs | 20 ++++++++++---------- tests/anoncreds_demos.rs | 3 +-- tests/utils/mock.rs | 2 +- tests/utils/mod.rs | 3 ++- tests/utils/{anoncreds.rs => storage.rs} | 0 6 files changed, 17 insertions(+), 17 deletions(-) rename tests/utils/{anoncreds.rs => storage.rs} (100%) diff --git a/src/ffi/presentation.rs b/src/ffi/presentation.rs index 8a95b8ec..0116d17f 100644 --- a/src/ffi/presentation.rs +++ b/src/ffi/presentation.rs @@ -24,7 +24,7 @@ impl_anoncreds_object_from_json!(Presentation, anoncreds_presentation_from_json) #[repr(C)] pub struct FfiCredentialEntry { credential: ObjectHandle, - timestamp: i64, + timestamp: i32, rev_state: ObjectHandle, } @@ -218,10 +218,10 @@ pub extern "C" fn anoncreds_create_presentation( pub struct FfiNonrevokedIntervalOverride<'a> { rev_reg_def_id: FfiStr<'a>, /// Timestamp in the `PresentationRequest` - requested_from_ts: i64, + requested_from_ts: i32, /// Timestamp from which verifier accepts, /// should be less than `req_timestamp` - override_rev_status_list_ts: i64, + override_rev_status_list_ts: i32, } impl<'a> FfiNonrevokedIntervalOverride<'a> { diff --git a/src/services/helpers.rs b/src/services/helpers.rs index 02326021..897a7904 100644 --- a/src/services/helpers.rs +++ b/src/services/helpers.rs @@ -146,7 +146,7 @@ pub fn get_revealed_attributes_for_credential( ) -> Result<(Vec, Option)> { trace!("_get_revealed_attributes_for_credential >>> sub_proof_index: {:?}, requested_credentials: {:?}, pres_req: {:?}", sub_proof_index, requested_proof, pres_req); - let mut nonrevoked_interval: Option = None; + let mut non_revoked_interval: Option = None; let mut revealed_attrs_for_credential = requested_proof .revealed_attrs .iter() @@ -157,11 +157,11 @@ pub fn get_revealed_attributes_for_credential( .map(|(attr_referent, _)| { let info = pres_req.requested_attributes[attr_referent].clone(); if let Some(int) = &info.non_revoked { - match nonrevoked_interval.as_mut() { + match non_revoked_interval.as_mut() { Some(ni) => { ni.compare_and_set(int); } - None => nonrevoked_interval = Some(int.clone()), + None => non_revoked_interval = Some(int.clone()), } }; @@ -180,11 +180,11 @@ pub fn get_revealed_attributes_for_credential( .map(|(attr_referent, _)| { let info = pres_req.requested_attributes[attr_referent].clone(); if let Some(int) = &info.non_revoked { - match nonrevoked_interval.as_mut() { + match non_revoked_interval.as_mut() { Some(ni) => { ni.compare_and_set(int); } - None => nonrevoked_interval = Some(NonRevokedInterval::default()), + None => non_revoked_interval = Some(NonRevokedInterval::default()), } }; info @@ -197,7 +197,7 @@ pub fn get_revealed_attributes_for_credential( revealed_attrs_for_credential ); - Ok((revealed_attrs_for_credential, nonrevoked_interval)) + Ok((revealed_attrs_for_credential, non_revoked_interval)) } pub fn get_predicates_for_credential( @@ -208,7 +208,7 @@ pub fn get_predicates_for_credential( trace!("_get_predicates_for_credential >>> sub_proof_index: {:?}, requested_credentials: {:?}, pres_req: {:?}", sub_proof_index, requested_proof, pres_req); - let mut nonrevoked_interval: Option = None; + let mut non_revoked_interval: Option = None; let predicates_for_credential = requested_proof .predicates .iter() @@ -221,11 +221,11 @@ pub fn get_predicates_for_credential( .map(|(predicate_referent, _)| { let info = pres_req.requested_predicates[predicate_referent].clone(); if let Some(int) = &info.non_revoked { - match nonrevoked_interval.as_mut() { + match non_revoked_interval.as_mut() { Some(ni) => { ni.compare_and_set(int); } - None => nonrevoked_interval = Some(int.clone()), + None => non_revoked_interval = Some(int.clone()), } }; @@ -238,5 +238,5 @@ pub fn get_predicates_for_credential( predicates_for_credential ); - Ok((predicates_for_credential, nonrevoked_interval)) + Ok((predicates_for_credential, non_revoked_interval)) } diff --git a/tests/anoncreds_demos.rs b/tests/anoncreds_demos.rs index 1a430f24..aed70f54 100644 --- a/tests/anoncreds_demos.rs +++ b/tests/anoncreds_demos.rs @@ -22,8 +22,7 @@ use anoncreds::{ use serde_json::json; -use self::utils::anoncreds::ProverWallet; - +use utils::*; mod utils; pub static SCHEMA_ID: &str = "mock:uri"; diff --git a/tests/utils/mock.rs b/tests/utils/mock.rs index c707ef1a..09b310c9 100644 --- a/tests/utils/mock.rs +++ b/tests/utils/mock.rs @@ -1,4 +1,4 @@ -use super::anoncreds::{IssuerWallet, Ledger, ProverWallet, StoredCredDef, StoredRevDef}; +use super::storage::{IssuerWallet, Ledger, ProverWallet, StoredCredDef, StoredRevDef}; use std::{ collections::{BTreeSet, HashMap}, fs::create_dir, diff --git a/tests/utils/mod.rs b/tests/utils/mod.rs index 7d38b6c6..c61542c2 100644 --- a/tests/utils/mod.rs +++ b/tests/utils/mod.rs @@ -1,4 +1,5 @@ -pub mod anoncreds; pub mod mock; +pub mod storage; pub use mock::*; +pub use storage::*; diff --git a/tests/utils/anoncreds.rs b/tests/utils/storage.rs similarity index 100% rename from tests/utils/anoncreds.rs rename to tests/utils/storage.rs