-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Minor refactoring around profiles Signed-off-by: Patrik Stas <patrik.stas@absa.africa> * Inject BaseWallet instead of Profile into IndyCredxAnonCreds Signed-off-by: Patrik Stas <patrik.stas@absa.africa> * Refactor ModularLibsProfile Signed-off-by: Patrik Stas <patrik.stas@absa.africa> * cargo fmt Signed-off-by: Patrik Stas <patrik.stas@absa.africa> * Refactor IndyProfile Signed-off-by: Patrik Stas <patrik.stas@absa.africa> * Rename IndysdkProfile to VdrtoolsProfile Signed-off-by: Patrik Stas <patrik.stas@absa.africa> * Fix test compile err Signed-off-by: Patrik Stas <patrik.stas@absa.africa> --------- Signed-off-by: Patrik Stas <patrik.stas@absa.africa>
- Loading branch information
1 parent
1ceae17
commit 9b9969b
Showing
16 changed files
with
193 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
pub mod indy_profile; | ||
pub mod modular_wallet_profile; | ||
pub mod modular_libs_profile; | ||
pub mod profile; | ||
pub mod vdrtools_profile; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
use std::sync::Arc; | ||
|
||
use vdrtools::{PoolHandle, WalletHandle}; | ||
|
||
use crate::plugins::{ | ||
anoncreds::{base_anoncreds::BaseAnonCreds, indy_anoncreds::IndySdkAnonCreds}, | ||
ledger::{base_ledger::BaseLedger, indy_ledger::IndySdkLedger}, | ||
wallet::{base_wallet::BaseWallet, indy_wallet::IndySdkWallet}, | ||
}; | ||
|
||
use super::profile::Profile; | ||
|
||
#[derive(Debug)] | ||
pub struct VdrtoolsProfile { | ||
wallet: Arc<dyn BaseWallet>, | ||
ledger: Arc<dyn BaseLedger>, | ||
anoncreds: Arc<dyn BaseAnonCreds>, | ||
} | ||
|
||
impl VdrtoolsProfile { | ||
pub fn new(indy_wallet_handle: WalletHandle, indy_pool_handle: PoolHandle) -> Self { | ||
let wallet = Arc::new(IndySdkWallet::new(indy_wallet_handle)); | ||
let ledger = Arc::new(IndySdkLedger::new(indy_wallet_handle, indy_pool_handle)); | ||
let anoncreds = Arc::new(IndySdkAnonCreds::new(indy_wallet_handle, indy_pool_handle)); | ||
VdrtoolsProfile { | ||
wallet, | ||
ledger, | ||
anoncreds, | ||
} | ||
} | ||
} | ||
|
||
impl Profile for VdrtoolsProfile { | ||
fn inject_ledger(self: Arc<Self>) -> Arc<dyn BaseLedger> { | ||
Arc::clone(&self.ledger) | ||
} | ||
|
||
fn inject_anoncreds(self: Arc<Self>) -> Arc<dyn BaseAnonCreds> { | ||
Arc::clone(&self.anoncreds) | ||
} | ||
|
||
fn inject_wallet(&self) -> Arc<dyn BaseWallet> { | ||
Arc::clone(&self.wallet) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.