Skip to content

Commit

Permalink
fix breaking changes in aries_vcx
Browse files Browse the repository at this point in the history
Signed-off-by: Swapnil Tripathi <swapnil06.st@gmail.com>
  • Loading branch information
swaptr committed Apr 12, 2023
1 parent f477a95 commit ba1cded
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 22 deletions.
30 changes: 23 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion aries_vcx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async-trait = "0.1.53"
env_logger = "0.9.0"
log = "0.4.16"
chrono = "0.4.23"
time = "0.1.44"
time = "0.3.20"
lazy_static = "1.3"
rand = "0.7.3"
serde = "1.0.97"
Expand Down
4 changes: 2 additions & 2 deletions aries_vcx/src/common/credentials/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{collections::HashMap, sync::Arc};

use time::get_time;
use time::OffsetDateTime;

use crate::core::profile::profile::Profile;
use crate::errors::error::{AriesVcxError, AriesVcxErrorKind, VcxResult};
Expand Down Expand Up @@ -36,7 +36,7 @@ pub async fn get_cred_rev_id(profile: &Arc<dyn Profile>, cred_id: &str) -> VcxRe

pub async fn is_cred_revoked(profile: &Arc<dyn Profile>, rev_reg_id: &str, rev_id: &str) -> VcxResult<bool> {
let from = None;
let to = Some(get_time().sec as u64 + 100);
let to = Some(OffsetDateTime::now_utc().unix_timestamp() as u64 + 100);
let rev_reg_delta = RevocationRegistryDelta::create_from_ledger(profile, rev_reg_id, from, to).await?;
Ok(rev_reg_delta.revoked().iter().any(|s| s.to_string().eq(rev_id)))
}
Expand Down
2 changes: 1 addition & 1 deletion aries_vcx/src/common/primitives/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pub mod integration_tests {

let ledger = Arc::clone(&setup.profile).inject_ledger();
let (id, _rev_reg, _timestamp) = ledger
.get_rev_reg(&rev_reg_id, time::get_time().sec as u64)
.get_rev_reg(&rev_reg_id, time::OffsetDateTime::now_utc().unix_timestamp() as u64)
.await
.unwrap();

Expand Down
2 changes: 1 addition & 1 deletion aries_vcx/src/common/signing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{global::settings, plugins::wallet::base_wallet::BaseWallet};
use messages::protocols::connection::response::{ConnectionData, ConnectionSignature, Response, SignedResponse};

async fn get_signature_data(wallet: &Arc<dyn BaseWallet>, data: String, key: &str) -> VcxResult<(Vec<u8>, Vec<u8>)> {
let now: u64 = time::get_time().sec as u64;
let now: u64 = time::OffsetDateTime::now_utc().unix_timestamp() as u64;
let mut sig_data = now.to_be_bytes().to_vec();
sig_data.extend(data.as_bytes());

Expand Down
2 changes: 1 addition & 1 deletion aries_vcx/src/indy/ledger/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ pub async fn get_rev_reg_delta_json(
let to = if let Some(_to) = to {
_to as i64
} else {
time::get_time().sec
time::OffsetDateTime::now_utc().unix_timestamp()
};

let req = libindy_build_get_revoc_reg_delta_request(&submitter_did, rev_reg_id, from, to).await?;
Expand Down
2 changes: 1 addition & 1 deletion aries_vcx/src/plugins/ledger/indy_vdr_ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ fn unimplemented_method_err(method_name: &str) -> AriesVcxError {
}

fn current_epoch_time() -> i64 {
time::get_time().sec
time::OffsetDateTime::now_utc().unix_timestamp() as i64
}

async fn _append_txn_author_agreement_to_request(request: PreparedRequest) -> VcxResult<PreparedRequest> {
Expand Down
4 changes: 2 additions & 2 deletions aries_vcx/tests/test_creds_proofs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ mod integration_tests {
DEFAULT_SCHEMA_ATTRS,
)
.await;
let to = time::get_time().sec;
let to = time::OffsetDateTime::now_utc().unix_timestamp() as u64;
let indy_proof_req = json!({
"nonce": "123432421212",
"name": "proof_req_1",
Expand Down Expand Up @@ -251,7 +251,7 @@ mod integration_tests {
DEFAULT_SCHEMA_ATTRS,
)
.await;
let to = time::get_time().sec;
let to = time::OffsetDateTime::now_utc().unix_timestamp() as u64;
let indy_proof_req = json!({
"nonce": "123432421212",
"name": "proof_req_1",
Expand Down
6 changes: 3 additions & 3 deletions aries_vcx/tests/test_creds_proofs_revocations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ mod integration_tests {

assert!(!issuer_credential.is_revoked(&institution.profile).await.unwrap());

let time_before_revocation = time::get_time().sec as u64;
let time_before_revocation = time::OffsetDateTime::now_utc().unix_timestamp() as u64;
info!("test_basic_revocation :: verifier :: Going to revoke credential");
revoke_credential_and_publish_accumulator(&mut institution, &issuer_credential, &rev_reg.rev_reg_id).await;
thread::sleep(Duration::from_millis(2000));
let time_after_revocation = time::get_time().sec as u64;
let time_after_revocation = time::OffsetDateTime::now_utc().unix_timestamp() as u64;

assert!(issuer_credential.is_revoked(&institution.profile).await.unwrap());

Expand Down Expand Up @@ -467,7 +467,7 @@ mod integration_tests {
assert!(!issuer_credential.is_revoked(&institution.profile).await.unwrap());

thread::sleep(Duration::from_millis(1000));
let time_before_revocation = time::get_time().sec as u64;
let time_before_revocation = time::OffsetDateTime::now_utc().unix_timestamp() as u64;
thread::sleep(Duration::from_millis(2000));
info!("test_revoked_credential_might_still_work :: verifier :: Going to revoke credential");
revoke_credential_and_publish_accumulator(&mut institution, &issuer_credential, &rev_reg.rev_reg_id).await;
Expand Down
2 changes: 1 addition & 1 deletion libvcx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ cfg-if = { version = "1.0" }
env_logger = "0.9.0"
log = "0.4.16"
chrono = "0.4.23"
time = "0.1.44"
time = "0.3.20"
lazy_static = "1.3"
libc = "=0.2.139"
rand = "0.7.3"
Expand Down
2 changes: 1 addition & 1 deletion libvcx_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ cfg-if = { version = "1.0" }
env_logger = "0.9.0"
log = "0.4.16"
chrono = "0.4.23"
time = "0.1.44"
time = "0.3.20"
lazy_static = "1.3"
libc = "=0.2.139"
rand = "0.7.3"
Expand Down
2 changes: 1 addition & 1 deletion messages/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ general_test = ["test_utils"]

[dependencies]
chrono = "0.4.23"
time = "0.1.36"
time = "0.3.20"
lazy_static = "1.3"
serde = "1.0.97"
serde_json = "1.0.40"
Expand Down

0 comments on commit ba1cded

Please sign in to comment.