Skip to content

Commit

Permalink
refactor(mediator-client-tui): move to separate package
Browse files Browse the repository at this point in the history
Signed-off-by: Naian <126972030+nain-F49FF806@users.noreply.github.com>
  • Loading branch information
nain-F49FF806 committed Oct 20, 2023
1 parent df49c68 commit e020eba
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 27 deletions.
20 changes: 18 additions & 2 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ members = [
"diddoc_legacy",
"agents/rust/mediator",
"agents/rust/mediator/client-webapi",
"agents/rust/mediator/client-tui",
"agents/rust/aries-vcx-agent",
"wrappers/vcx-napi-rs",
"aries_vcx_core",
Expand Down
7 changes: 0 additions & 7 deletions agents/rust/mediator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ edition = "2021"

[features]
default = ["client"]
# default = ["client_http_api"]
client = []
client_http_api = ["client"]
client_tui = ["client", "cursive"]


[dependencies]
anyhow = "1.0.75"
Expand All @@ -22,9 +18,6 @@ aries_vcx_core = { path = "../../../aries_vcx_core", features = [
async-trait = "0.1.73"
axum = "0.6"
axum-macros = "0.3.8"
cursive = { version = "0.20.0", features = [
"crossterm-backend",
], optional = true }
diddoc_legacy = { path = "../../../diddoc_legacy" }
dotenvy = "0.15"
env_logger = "0.10.0"
Expand Down
22 changes: 22 additions & 0 deletions agents/rust/mediator/client-tui/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "client-tui"
version = "0.1.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
aries_vcx_core = { path = "../../../../aries_vcx_core", features = [
"vdrtools_wallet",
] }
axum = "0.6.20"
client-webapi = { path = "../client-webapi" }
cursive = { version = "0.20.0", features = ["crossterm-backend"] }
futures = "0.3.28"
log = "0.4.20"
mediation = { path = "../mediation" }
mediator = { path = ".." }
messages = { path = "../../../../messages" }
serde_json = "1.0.107"

tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/// Aries Agent TUI
#[cfg(feature = "client_tui")]
mod tui;
#[tokio::main]
async fn main() {
use mediator::{
aries_agent::AgentBuilder,
tui,
utils::binary_utils::{load_dot_env, setup_logging},
};

Expand All @@ -15,10 +14,9 @@ async fn main() {
tui::init_tui(agent).await;
}

#[cfg(not(feature = "client_tui"))]
fn main() {
print!(
"This is a placeholder binary. Please enable \"client_tui\" feature to to build the \
functional client_tui binary."
)
}
// fn main() {
// print!(
// "This is a placeholder binary. Please enable \"client_tui\" feature to to build the \
// functional client_tui binary."
// )
// }
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::sync::Arc;

use aries_vcx_core::wallet::base_wallet::BaseWallet;
use axum::{extract::State, Json};
use client_webapi::http_routes::handle_register;
use cursive::{
direction::Orientation,
event::Key,
Expand All @@ -15,10 +16,9 @@ use cursive::{
use futures::executor::block_on;
use log::info;
use mediation::storage::MediatorPersistence;
use mediator::aries_agent::Agent;
use messages::msg_fields::protocols::out_of_band::invitation::Invitation as OOBInvitation;

use crate::{aries_agent::Agent, http_routes::client::handle_register};

pub async fn init_tui<T: BaseWallet + 'static, P: MediatorPersistence>(agent: Agent<T, P>) {
let mut cursive = Cursive::new();
cursive.add_global_callback(Key::Esc, |s| s.quit());
Expand Down
2 changes: 1 addition & 1 deletion agents/rust/mediator/client-webapi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "client-webapi"
version = "0.1.0"
version = "0.1.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
1 change: 1 addition & 0 deletions agents/rust/mediator/client-webapi/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod http_routes;
4 changes: 1 addition & 3 deletions agents/rust/mediator/client-webapi/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/// Client-side focused api accessible Aries Agent
mod http_routes;

#[tokio::main]
async fn main() {
use http_routes::build_client_router;
use client_webapi::http_routes::build_client_router;
use mediator::{
aries_agent::AgentBuilder,
utils::binary_utils::{load_dot_env, setup_logging},
Expand Down
3 changes: 0 additions & 3 deletions agents/rust/mediator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@ pub mod aries_agent;
pub mod didcomm_handlers;
pub mod http_routes;
pub mod utils;

#[cfg(feature = "client_tui")]
pub mod tui;

0 comments on commit e020eba

Please sign in to comment.