Skip to content

Commit

Permalink
fixes: PR fixes and rename test files
Browse files Browse the repository at this point in the history
Signed-off-by: bwty <[email protected]>
  • Loading branch information
whalelephant committed Feb 17, 2023
1 parent d88e902 commit 0a57d4d
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/ffi/presentation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down Expand Up @@ -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> {
Expand Down
20 changes: 10 additions & 10 deletions src/services/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ pub fn get_revealed_attributes_for_credential(
) -> Result<(Vec<AttributeInfo>, Option<NonRevokedInterval>)> {
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<NonRevokedInterval> = None;
let mut non_revoked_interval: Option<NonRevokedInterval> = None;
let mut revealed_attrs_for_credential = requested_proof
.revealed_attrs
.iter()
Expand All @@ -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()),
}
};

Expand All @@ -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
Expand All @@ -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(
Expand All @@ -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<NonRevokedInterval> = None;
let mut non_revoked_interval: Option<NonRevokedInterval> = None;
let predicates_for_credential = requested_proof
.predicates
.iter()
Expand All @@ -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()),
}
};

Expand All @@ -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))
}
3 changes: 1 addition & 2 deletions tests/anoncreds_demos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/mock.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
3 changes: 2 additions & 1 deletion tests/utils/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub mod anoncreds;
pub mod mock;
pub mod storage;

pub use mock::*;
pub use storage::*;
File renamed without changes.

0 comments on commit 0a57d4d

Please sign in to comment.