Skip to content

Commit

Permalink
Adjusted feature flags and code
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Mircea <mirceapetrebogdan@gmail.com>
  • Loading branch information
bobozaur committed Oct 24, 2023
1 parent df339f3 commit 36b6e9e
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 123 deletions.
2 changes: 1 addition & 1 deletion aries_vcx/tests/test_credential_retrieval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ async fn test_agency_pool_case_for_proof_req_doesnt_matter_for_retrieve_creds()
#[ignore]
#[allow(unused_mut)]
async fn test_agency_pool_it_should_fail_to_select_credentials_for_predicate() {
use aries_vcx::utils::devsetup::SetupPoolDirectory;
use test_utils::devsetup::SetupPoolDirectory;
use utils::{
scenarios::prover_select_credentials,
test_agent::{create_test_agent, create_test_agent_trustee},
Expand Down
7 changes: 3 additions & 4 deletions aries_vcx/tests/utils/test_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use aries_vcx_core::{
ledger::base_ledger::{
AnoncredsLedgerRead, AnoncredsLedgerWrite, IndyLedgerRead, IndyLedgerWrite,
},
wallet::{base_wallet::BaseWallet, indy::IndySdkWallet},
wallet::base_wallet::BaseWallet,
};
use test_utils::{
constants::TRUSTEE_SEED,
devsetup::{dev_build_featured_components, dev_setup_wallet_indy},
devsetup::{dev_build_featured_components, dev_build_featured_wallet},
random::generate_random_seed,
};

Expand Down Expand Up @@ -38,8 +38,7 @@ async fn create_test_agent_from_seed(
impl BaseAnonCreds,
impl BaseWallet,
> {
let (institution_did, wallet_handle) = dev_setup_wallet_indy(seed).await;
let wallet = IndySdkWallet::new(wallet_handle);
let (institution_did, wallet) = dev_build_featured_wallet(seed).await;
let (ledger_read, ledger_write, anoncreds) =
dev_build_featured_components(genesis_file_path.clone()).await;

Expand Down
89 changes: 0 additions & 89 deletions aries_vcx_core/src/wallet/indy/did_mocks.rs

This file was deleted.

1 change: 0 additions & 1 deletion aries_vcx_core/src/wallet/indy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use crate::{
SearchHandle, WalletHandle,
};

pub mod did_mocks;
pub mod indy_wallet;
pub mod internal;
pub mod signing;
Expand Down
20 changes: 1 addition & 19 deletions aries_vcx_core/src/wallet/indy/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ use vdrtools::{

use crate::{
errors::error::{AriesVcxCoreError, AriesVcxCoreErrorKind, VcxCoreResult},
wallet::indy::{
did_mocks::{did_mocks_enabled, DidMocks},
IssuerConfig, RestoreWalletConfigs, WalletConfig,
},
wallet::indy::{IssuerConfig, RestoreWalletConfigs, WalletConfig},
};

pub async fn open_wallet(wallet_config: &WalletConfig) -> VcxCoreResult<WalletHandle> {
Expand Down Expand Up @@ -317,11 +314,6 @@ pub async fn libindy_replace_keys_start(
wallet_handle: WalletHandle,
did: &str,
) -> VcxCoreResult<String> {
if DidMocks::has_did_mock_responses() {
warn!("libindy_replace_keys_start >> retrieving did mock response");
return Ok(DidMocks::get_next_did_response());
}

let res = Locator::instance()
.did_controller
.replace_keys_start(wallet_handle, KeyInfo::default(), DidValue(did.into()))
Expand All @@ -334,11 +326,6 @@ pub async fn libindy_replace_keys_apply(
wallet_handle: WalletHandle,
did: &str,
) -> VcxCoreResult<()> {
if did_mocks_enabled() {
warn!("libindy_replace_keys_apply >> retrieving did mock response");
return Ok(());
}

Locator::instance()
.did_controller
.replace_keys_apply(wallet_handle, DidValue(did.into()))
Expand All @@ -351,11 +338,6 @@ pub async fn get_verkey_from_wallet(
wallet_handle: WalletHandle,
did: &str,
) -> VcxCoreResult<String> {
if DidMocks::has_did_mock_responses() {
warn!("get_verkey_from_wallet >> retrieving did mock response");
return Ok(DidMocks::get_next_did_response());
}

let res = Locator::instance()
.did_controller
.key_for_local_did(wallet_handle, DidValue(did.into()))
Expand Down
17 changes: 8 additions & 9 deletions tools/test_utils/src/devsetup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ use aries_vcx_core::{ledger::request_submitter::vdr_proxy::VdrProxySubmitter, Vd
#[cfg(feature = "vdrtools_wallet")]
use aries_vcx_core::{
wallet::indy::{
did_mocks::DidMocks,
wallet::{create_and_open_wallet, create_and_store_my_did},
WalletConfig,
},
Expand Down Expand Up @@ -148,7 +147,6 @@ pub struct SetupPoolDirectory {
pub fn reset_global_state() {
warn!("reset_global_state >>");
AgencyMockDecrypted::clear_mocks();
DidMocks::clear_mocks();
}

impl SetupMocks {
Expand All @@ -165,6 +163,7 @@ impl Drop for SetupMocks {
}
}

#[cfg(feature = "vdrtools_wallet")]
pub async fn dev_setup_wallet_indy(key_seed: &str) -> (String, WalletHandle) {
info!("dev_setup_wallet_indy >>");
let config_wallet = WalletConfig {
Expand All @@ -186,7 +185,7 @@ pub async fn dev_setup_wallet_indy(key_seed: &str) -> (String, WalletHandle) {
(did, wallet_handle)
}

#[cfg(all(feature = "credx", feature = "vdrtools_wallet"))]
#[cfg(feature = "credx")]
pub fn dev_build_profile_modular(
genesis_file_path: String,
) -> (
Expand Down Expand Up @@ -275,24 +274,24 @@ pub async fn dev_build_featured_components(
}

#[cfg(feature = "vdrtools_wallet")]
pub async fn dev_build_indy_wallet() -> (String, impl BaseWallet) {
pub async fn dev_build_indy_wallet(key_seed: &str) -> (String, impl BaseWallet) {
use aries_vcx_core::wallet::indy::IndySdkWallet;

let (public_did, wallet_handle) = dev_setup_wallet_indy(TRUSTEE_SEED).await;
let (public_did, wallet_handle) = dev_setup_wallet_indy(key_seed).await;
(public_did, IndySdkWallet::new(wallet_handle))
}

#[allow(unreachable_code)]
#[allow(unused_variables)]
pub async fn dev_build_featured_wallet() -> (String, impl BaseWallet) {
pub async fn dev_build_featured_wallet(key_seed: &str) -> (String, impl BaseWallet) {
#[cfg(feature = "vdrtools_wallet")]
return {
info!("SetupProfile >> using indy wallet");
dev_build_indy_wallet().await
dev_build_indy_wallet(key_seed).await
};

#[cfg(not(feature = "vdrtools_wallet"))]
return { (String::new(), MockWallet) };
return (String::new(), MockWallet);
}

#[macro_export]
Expand All @@ -315,7 +314,7 @@ pub async fn build_setup_profile() -> SetupProfile<
let genesis_file_path = get_temp_file_path(POOL1_TXN).to_str().unwrap().to_string();
create_testpool_genesis_txn_file(&genesis_file_path);

let (institution_did, wallet) = dev_build_featured_wallet().await;
let (institution_did, wallet) = dev_build_featured_wallet(TRUSTEE_SEED).await;
let (ledger_read, ledger_write, anoncreds) =
dev_build_featured_components(genesis_file_path.clone()).await;
anoncreds
Expand Down

0 comments on commit 36b6e9e

Please sign in to comment.