Skip to content

Commit

Permalink
fix mediator and clean some todos
Browse files Browse the repository at this point in the history
Signed-off-by: gmulhearn <[email protected]>
  • Loading branch information
gmulhearn committed Oct 12, 2024
1 parent 24dc152 commit dbbf23d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
3 changes: 2 additions & 1 deletion aries/agents/aries-vcx-agent/src/agent/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ pub async fn build_askar_wallet(
_wallet_config: WalletInitConfig,
issuer_seed: String,
) -> (AskarWallet, IssuerConfig) {
// TODO - actually impl this
// TODO - use actual config with storage path etc
// simple in-memory wallet
let config_wallet = AskarWalletConfig::new(
"sqlite://:memory:",
KeyMethod::Unprotected,
Expand Down
26 changes: 16 additions & 10 deletions aries/agents/mediator/src/bin/mediator.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use aries_vcx_wallet::wallet::askar::{askar_wallet_config::AskarWalletConfig, AskarWallet};
use aries_vcx_wallet::wallet::askar::{
askar_wallet_config::AskarWalletConfig, key_method::KeyMethod, AskarWallet,
};
use log::info;
use mediator::aries_agent::AgentBuilder;
use uuid::Uuid;

#[tokio::main]
async fn main() {
Expand All @@ -9,16 +12,19 @@ async fn main() {
info!("Starting up mediator! ⚙️⚙️");
let endpoint_root = std::env::var("ENDPOINT_ROOT").unwrap_or("127.0.0.1:8005".into());
info!("Mediator endpoint root address: {}", endpoint_root);
let wallet_config_json = std::env::var("INDY_WALLET_CONFIG").unwrap_or(
"{
\"wallet_name\": \"demo-wallet\",
\"wallet_key\" : \"8dvfYSt5d1taSd6yJdpjq4emkwsPDDLYxkNFysFD2cZY\",
\"wallet_key_derivation\": \"RAW\"
}"
.to_string(),
// default wallet config for a dummy in-memory wallet
let default_wallet_config = AskarWalletConfig::new(
"sqlite://:memory:",
KeyMethod::Unprotected,
"",
&Uuid::new_v4().to_string(),
);
// TODO - actually impl this
let wallet_config: AskarWalletConfig = serde_json::from_str(&wallet_config_json).unwrap();
let wallet_config_json = std::env::var("INDY_WALLET_CONFIG");
let wallet_config = wallet_config_json
.ok()
.map_or(default_wallet_config, |json| {
serde_json::from_str(&json).unwrap()
});
info!("Wallet Config: {:?}", wallet_config);
let mut agent = AgentBuilder::<AskarWallet>::new_from_wallet_config(wallet_config)
.await
Expand Down
10 changes: 1 addition & 9 deletions aries/misc/test_utils/src/devsetup/askar_wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,13 @@ use uuid::Uuid;

pub async fn dev_setup_wallet_askar(key_seed: &str) -> (String, AskarWallet) {
info!("dev_setup_wallet_askar >>");
// TODO - actually impl this
// simple in-memory wallet
let config_wallet = AskarWalletConfig::new(
"sqlite://:memory:",
KeyMethod::Unprotected,
"",
&Uuid::new_v4().to_string(),
);
// wallet_name: format!("wallet_{}", uuid::Uuid::new_v4()),
// wallet_key: DEFAULT_WALLET_KEY.into(),
// wallet_key_derivation: WALLET_KDF_RAW.into(),
// wallet_type: None,
// storage_config: None,
// storage_credentials: None,
// rekey: None,
// rekey_derivation_method: None,

let wallet = config_wallet.create_wallet().await.unwrap();

Expand Down

0 comments on commit dbbf23d

Please sign in to comment.