Skip to content

Commit

Permalink
refactor: remove client-webapi (#1041)
Browse files Browse the repository at this point in the history
Signed-off-by: Naian <[email protected]>
  • Loading branch information
nain-F49FF806 authored Oct 31, 2023
1 parent 63590d1 commit 4e65aec
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 120 deletions.
16 changes: 0 additions & 16 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ members = [
"shared_vcx",
"diddoc_legacy",
"agents/rust/mediator",
"agents/rust/mediator/client-webapi",
"agents/rust/mediator/client-tui",
"agents/rust/aries-vcx-agent",
"wrappers/vcx-napi-rs",
Expand Down
2 changes: 1 addition & 1 deletion agents/rust/mediator/client-tui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ 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" }
reqwest = "0.11.22"
serde_json = "1.0.107"

tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
25 changes: 25 additions & 0 deletions agents/rust/mediator/client-tui/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use std::collections::VecDeque;

use aries_vcx_core::wallet::base_wallet::BaseWallet;
use mediation::storage::MediatorPersistence;
use mediator::aries_agent::{transports::AriesReqwest, ArcAgent};
use messages::msg_fields::protocols::out_of_band::invitation::Invitation as OOBInvitation;
use serde_json::{json, Value};

pub async fn handle_register(
agent: ArcAgent<impl BaseWallet + 'static, impl MediatorPersistence>,
oob_invite: OOBInvitation,
) -> Result<Value, String> {
let mut aries_transport = AriesReqwest {
response_queue: VecDeque::new(),
client: reqwest::Client::new(),
};
let state = agent
.establish_connection(oob_invite, &mut aries_transport)
.await
.map_err(|err| format!("{err:?}"))?;
Ok(json!({
"status": "success",
"connection_completed": state
}))
}
3 changes: 2 additions & 1 deletion agents/rust/mediator/client-tui/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// Aries Agent TUI
mod tui;

/// Aries Agent TUI
#[tokio::main]
async fn main() {
use mediator::{
Expand Down
7 changes: 3 additions & 4 deletions agents/rust/mediator/client-tui/src/tui.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,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 client_tui::handle_register;
use cursive::{
direction::Orientation,
event::Key,
Expand Down Expand Up @@ -103,8 +102,8 @@ pub fn client_register_connect_cb<T: BaseWallet + 'static, P: MediatorPersistenc
let agent: &mut Arc<Agent<T, P>> = s.user_data().expect("Userdata should contain Agent");

output.set_content(format!("{:#?}", oob_invite));
match block_on(handle_register(State(agent.to_owned()), Json(oob_invite))) {
Ok(Json(res_json)) => output.set_content(serde_json::to_string_pretty(&res_json).unwrap()),
match block_on(handle_register(agent.to_owned(), oob_invite)) {
Ok(res_json) => output.set_content(serde_json::to_string_pretty(&res_json).unwrap()),
Err(err) => output.set_content(err),
};
}
Expand Down
20 changes: 0 additions & 20 deletions agents/rust/mediator/client-webapi/Cargo.toml

This file was deleted.

9 changes: 0 additions & 9 deletions agents/rust/mediator/client-webapi/README.md

This file was deleted.

35 changes: 0 additions & 35 deletions agents/rust/mediator/client-webapi/src/http_routes.rs

This file was deleted.

1 change: 0 additions & 1 deletion agents/rust/mediator/client-webapi/src/lib.rs

This file was deleted.

32 changes: 0 additions & 32 deletions agents/rust/mediator/client-webapi/src/main.rs

This file was deleted.

0 comments on commit 4e65aec

Please sign in to comment.