From 3ff462248dbffa3fff5c272954993f67267be692 Mon Sep 17 00:00:00 2001 From: Patrik Stas Date: Mon, 14 Aug 2023 23:45:58 +0200 Subject: [PATCH 01/10] Tweak inviter to extract msg sending out Signed-off-by: Patrik Stas --- .../src/services/connection.rs | 6 ++-- .../src/protocols/connection/generic/mod.rs | 8 +----- .../src/protocols/connection/inviter/mod.rs | 28 +++++++------------ .../src/api_vcx/api_handle/connection.rs | 6 ++-- .../src/handlers/connection/connection.rs | 6 ++-- 5 files changed, 23 insertions(+), 31 deletions(-) diff --git a/agents/rust/aries-vcx-agent/src/services/connection.rs b/agents/rust/aries-vcx-agent/src/services/connection.rs index 52244dc830..6d93568b4a 100644 --- a/agents/rust/aries-vcx-agent/src/services/connection.rs +++ b/agents/rust/aries-vcx-agent/src/services/connection.rs @@ -102,9 +102,11 @@ impl ServiceConnections { pub async fn send_response(&self, thread_id: &str) -> AgentResult<()> { let inviter: Connection<_, _> = self.connections.get(thread_id)?.try_into()?; - let inviter = inviter - .send_response(&self.profile.inject_wallet(), &HttpClient) + let response = inviter.get_connection_response_msg(); + inviter + .send_message(&self.profile.inject_wallet(), &response.into(), &HttpClient) .await?; + let inviter = inviter.mark_response_sent()?; self.connections.insert(thread_id, inviter.into())?; diff --git a/aries_vcx/src/protocols/connection/generic/mod.rs b/aries_vcx/src/protocols/connection/generic/mod.rs index 4312d263de..ec1d9c84e1 100644 --- a/aries_vcx/src/protocols/connection/generic/mod.rs +++ b/aries_vcx/src/protocols/connection/generic/mod.rs @@ -483,13 +483,7 @@ mod connection_serde_tests { } async fn make_inviter_responded() -> InviterConnection { - let wallet: Arc = Arc::new(MockWallet {}); - - make_inviter_requested() - .await - .send_response(&wallet, &MockTransport) - .await - .unwrap() + make_inviter_requested().await.mark_response_sent().unwrap() } async fn make_inviter_completed() -> InviterConnection { diff --git a/aries_vcx/src/protocols/connection/inviter/mod.rs b/aries_vcx/src/protocols/connection/inviter/mod.rs index 2255875f19..1787ab4121 100644 --- a/aries_vcx/src/protocols/connection/inviter/mod.rs +++ b/aries_vcx/src/protocols/connection/inviter/mod.rs @@ -233,31 +233,23 @@ impl InviterConnection { } impl InviterConnection { - /// Sends a [`Response`] to the invitee and transitions to [`InviterConnection`]. + /// Returns pre-built [`Response`] message which shall be delivered to counterparty /// /// # Errors /// /// Will return an error if sending the response fails. - pub async fn send_response( - self, - wallet: &Arc, - transport: &T, - ) -> VcxResult> - where - T: Transport, - { - trace!( - "Connection::send_response >>> signed_response: {:?}", - &self.state.signed_response - ); + pub fn get_connection_response_msg(&self) -> Response { + self.state.signed_response.clone() + } + /// Transitions to [`InviterConnection`] under assumption the caller has assured delivery of [`Response`] message + /// + /// # Errors + /// + /// Will return an error if sending the response fails. + pub fn mark_response_sent(self) -> VcxResult> { let thread_id = self.state.signed_response.decorators.thread.thid.clone(); - - self.send_message(wallet, &self.state.signed_response.clone().into(), transport) - .await?; - let state = Responded::new(self.state.did_doc, thread_id); - Ok(Connection { state, source_id: self.source_id, diff --git a/libvcx_core/src/api_vcx/api_handle/connection.rs b/libvcx_core/src/api_vcx/api_handle/connection.rs index b2d1436e84..0d73e48008 100644 --- a/libvcx_core/src/api_vcx/api_handle/connection.rs +++ b/libvcx_core/src/api_vcx/api_handle/connection.rs @@ -330,8 +330,10 @@ pub async fn send_response(handle: u32) -> LibvcxResult<()> { trace!("send_response >>>"); let con = get_cloned_connection(&handle)?; - let con = con.send_response(&get_main_wallet()?, &HttpClient).await?; - + let response = con.get_connection_response_msg(); + con.send_message(&get_main_wallet()?, &response.into(), &HttpClient) + .await?; + let con = con.mark_response_sent()?; insert_connection(handle, con) } diff --git a/uniffi_aries_vcx/core/src/handlers/connection/connection.rs b/uniffi_aries_vcx/core/src/handlers/connection/connection.rs index 463fa7ea2c..e634a966f6 100644 --- a/uniffi_aries_vcx/core/src/handlers/connection/connection.rs +++ b/uniffi_aries_vcx/core/src/handlers/connection/connection.rs @@ -149,9 +149,11 @@ impl Connection { let connection = VcxConnection::try_from(handler.clone())?; block_on(async { - let new_conn = connection - .send_response(&profile.inner.inject_wallet(), &HttpClient) + let response = connection.get_connection_response_msg(); + connection + .send_message(&profile.inner.inject_wallet(), &response.into(), &HttpClient) .await?; + let new_conn = connection.mark_response_sent()?; *handler = VcxGenericConnection::from(new_conn); From 67edcf922894fa106bc996603766e7d7cfcb0f6c Mon Sep 17 00:00:00 2001 From: Patrik Stas Date: Tue, 22 Aug 2023 00:35:47 +0200 Subject: [PATCH 02/10] Remove intermediary Connection Inviter's state 'Responded' Signed-off-by: Patrik Stas --- .../src/services/connection.rs | 1 - .../connection/generic/conversions.rs | 3 -- .../src/protocols/connection/generic/mod.rs | 13 +-------- .../connection/generic/thin_state.rs | 1 - .../src/protocols/connection/inviter/mod.rs | 28 ++++--------------- .../connection/inviter/states/mod.rs | 1 - .../connection/inviter/states/responded.rs | 27 ------------------ .../src/protocols/connection/serializable.rs | 3 -- .../src/api_vcx/api_handle/connection.rs | 1 - .../src/handlers/connection/connection.rs | 3 +- wrappers/node/src/api/common.ts | 1 - 11 files changed, 8 insertions(+), 74 deletions(-) delete mode 100644 aries_vcx/src/protocols/connection/inviter/states/responded.rs diff --git a/agents/rust/aries-vcx-agent/src/services/connection.rs b/agents/rust/aries-vcx-agent/src/services/connection.rs index 6d93568b4a..59175a3fbd 100644 --- a/agents/rust/aries-vcx-agent/src/services/connection.rs +++ b/agents/rust/aries-vcx-agent/src/services/connection.rs @@ -106,7 +106,6 @@ impl ServiceConnections { inviter .send_message(&self.profile.inject_wallet(), &response.into(), &HttpClient) .await?; - let inviter = inviter.mark_response_sent()?; self.connections.insert(thread_id, inviter.into())?; diff --git a/aries_vcx/src/protocols/connection/generic/conversions.rs b/aries_vcx/src/protocols/connection/generic/conversions.rs index 9b3417b56f..cea40ac960 100644 --- a/aries_vcx/src/protocols/connection/generic/conversions.rs +++ b/aries_vcx/src/protocols/connection/generic/conversions.rs @@ -11,7 +11,6 @@ use crate::{ inviter::states::{ completed::Completed as InviterCompleted, initial::Initial as InviterInitial, invited::Invited as InviterInvited, requested::Requested as InviterRequested, - responded::Responded as InviterResponded, }, Connection, }, @@ -107,7 +106,6 @@ from_concrete_to_vague!(Invitee, InviteeState, Invitee, GenericState); from_concrete_to_vague!(InviterInitial, Initial, InviterState); from_concrete_to_vague!(InviterInvited, Invited, InviterState); from_concrete_to_vague!(InviterRequested, Requested, InviterState); -from_concrete_to_vague!(InviterResponded, Responded, InviterState); from_concrete_to_vague!(InviterCompleted, Completed, InviterState); from_concrete_to_vague!(InviteeInitial, Initial, InviteeState); @@ -136,7 +134,6 @@ try_from_vague_to_concrete!(InviteeState, Invitee, Inviter, Invitee); try_from_vague_to_concrete!(InviterState, Initial, InviterInitial); try_from_vague_to_concrete!(InviterState, Invited, InviterInvited); try_from_vague_to_concrete!(InviterState, Requested, InviterRequested); -try_from_vague_to_concrete!(InviterState, Responded, InviterResponded); try_from_vague_to_concrete!(InviterState, Completed, InviterCompleted); try_from_vague_to_concrete!(InviteeState, Initial, InviteeInitial); diff --git a/aries_vcx/src/protocols/connection/generic/mod.rs b/aries_vcx/src/protocols/connection/generic/mod.rs index ec1d9c84e1..ce9f8cef74 100644 --- a/aries_vcx/src/protocols/connection/generic/mod.rs +++ b/aries_vcx/src/protocols/connection/generic/mod.rs @@ -21,7 +21,6 @@ use crate::{ inviter::states::{ completed::Completed as InviterCompleted, initial::Initial as InviterInitial, invited::Invited as InviterInvited, requested::Requested as InviterRequested, - responded::Responded as InviterResponded, }, pairwise_info::PairwiseInfo, trait_bounds::{TheirDidDoc, ThreadId}, @@ -88,7 +87,6 @@ pub enum InviterState { Initial(InviterInitial), Invited(InviterInvited), Requested(InviterRequested), - Responded(InviterResponded), Completed(InviterCompleted), } @@ -119,7 +117,6 @@ impl GenericConnection { GenericState::Inviter(InviterState::Initial(_)) => None, GenericState::Inviter(InviterState::Invited(s)) => Some(s.thread_id()), GenericState::Inviter(InviterState::Requested(s)) => Some(s.thread_id()), - GenericState::Inviter(InviterState::Responded(s)) => Some(s.thread_id()), GenericState::Inviter(InviterState::Completed(s)) => Some(s.thread_id()), } } @@ -138,7 +135,6 @@ impl GenericConnection { GenericState::Inviter(InviterState::Initial(_)) => None, GenericState::Inviter(InviterState::Invited(_)) => None, GenericState::Inviter(InviterState::Requested(s)) => Some(s.their_did_doc()), - GenericState::Inviter(InviterState::Responded(s)) => Some(s.their_did_doc()), GenericState::Inviter(InviterState::Completed(s)) => Some(s.their_did_doc()), } } @@ -251,7 +247,6 @@ mod connection_serde_tests { RefInviterState::Initial(s) => Self::Initial(s.to_owned()), RefInviterState::Invited(s) => Self::Invited(s.to_owned()), RefInviterState::Requested(s) => Self::Requested(s.to_owned()), - RefInviterState::Responded(s) => Self::Responded(s.to_owned()), RefInviterState::Completed(s) => Self::Completed(s.to_owned()), } } @@ -300,7 +295,6 @@ mod connection_serde_tests { InviterState::Initial(s) => Self::Initial(s), InviterState::Invited(s) => Self::Invited(s), InviterState::Requested(s) => Self::Requested(s), - InviterState::Responded(s) => Self::Responded(s), InviterState::Completed(s) => Self::Completed(s), } } @@ -482,12 +476,8 @@ mod connection_serde_tests { .unwrap() } - async fn make_inviter_responded() -> InviterConnection { - make_inviter_requested().await.mark_response_sent().unwrap() - } - async fn make_inviter_completed() -> InviterConnection { - let con = make_inviter_responded().await; + let con = make_inviter_requested().await; let content = AckContent::new(AckStatus::Ok); let decorators = AckDecorators::new(Thread::new(con.thread_id().to_owned())); @@ -515,6 +505,5 @@ mod connection_serde_tests { generate_test!(inviter_connection_initial, make_inviter_initial); generate_test!(inviter_connection_invited, make_inviter_invited); generate_test!(inviter_connection_requested, make_inviter_requested); - generate_test!(inviter_connection_responded, make_inviter_responded); generate_test!(inviter_connection_complete, make_inviter_completed); } diff --git a/aries_vcx/src/protocols/connection/generic/thin_state.rs b/aries_vcx/src/protocols/connection/generic/thin_state.rs index 9cbadce48e..53842dd411 100644 --- a/aries_vcx/src/protocols/connection/generic/thin_state.rs +++ b/aries_vcx/src/protocols/connection/generic/thin_state.rs @@ -34,7 +34,6 @@ impl From<&InviterState> for State { InviterState::Initial(_) => Self::Initial, InviterState::Invited(_) => Self::Invited, InviterState::Requested(_) => Self::Requested, - InviterState::Responded(_) => Self::Responded, InviterState::Completed(_) => Self::Completed, } } diff --git a/aries_vcx/src/protocols/connection/inviter/mod.rs b/aries_vcx/src/protocols/connection/inviter/mod.rs index 1787ab4121..bc8a95b53d 100644 --- a/aries_vcx/src/protocols/connection/inviter/mod.rs +++ b/aries_vcx/src/protocols/connection/inviter/mod.rs @@ -21,9 +21,7 @@ use crate::protocols::connection::trait_bounds::ThreadId; use crate::transport::Transport; use crate::{common::signing::sign_connection_response, errors::error::VcxResult}; -use self::states::{ - completed::Completed, initial::Initial, invited::Invited, requested::Requested, responded::Responded, -}; +use self::states::{completed::Completed, initial::Initial, invited::Invited, requested::Requested}; use super::{initiation_type::Inviter, pairwise_info::PairwiseInfo, Connection}; use aries_vcx_core::wallet::base_wallet::BaseWallet; @@ -242,24 +240,6 @@ impl InviterConnection { self.state.signed_response.clone() } - /// Transitions to [`InviterConnection`] under assumption the caller has assured delivery of [`Response`] message - /// - /// # Errors - /// - /// Will return an error if sending the response fails. - pub fn mark_response_sent(self) -> VcxResult> { - let thread_id = self.state.signed_response.decorators.thread.thid.clone(); - let state = Responded::new(self.state.did_doc, thread_id); - Ok(Connection { - state, - source_id: self.source_id, - pairwise_info: self.pairwise_info, - initiation_type: self.initiation_type, - }) - } -} - -impl InviterConnection { /// Acknowledges an invitee's connection by processing their first message /// and transitions to [`InviterConnection`]. /// @@ -269,7 +249,11 @@ impl InviterConnection { /// the ID of the thread context used in this connection. pub fn acknowledge_connection(self, msg: &AriesMessage) -> VcxResult> { verify_thread_id(self.state.thread_id(), msg)?; - let state = Completed::new(self.state.did_doc, self.state.thread_id, None); + let state = Completed::new( + self.state.did_doc, + self.state.signed_response.decorators.thread.thid, + None, + ); Ok(Connection { source_id: self.source_id, diff --git a/aries_vcx/src/protocols/connection/inviter/states/mod.rs b/aries_vcx/src/protocols/connection/inviter/states/mod.rs index 0cc0ecd220..b0953d0d5a 100644 --- a/aries_vcx/src/protocols/connection/inviter/states/mod.rs +++ b/aries_vcx/src/protocols/connection/inviter/states/mod.rs @@ -2,4 +2,3 @@ pub mod completed; pub mod initial; pub mod invited; pub mod requested; -pub mod responded; diff --git a/aries_vcx/src/protocols/connection/inviter/states/responded.rs b/aries_vcx/src/protocols/connection/inviter/states/responded.rs deleted file mode 100644 index 548581cd75..0000000000 --- a/aries_vcx/src/protocols/connection/inviter/states/responded.rs +++ /dev/null @@ -1,27 +0,0 @@ -use diddoc_legacy::aries::diddoc::AriesDidDoc; - -use crate::protocols::connection::trait_bounds::{TheirDidDoc, ThreadId}; - -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] -pub struct Responded { - pub(crate) did_doc: AriesDidDoc, - pub(crate) thread_id: String, -} - -impl Responded { - pub fn new(did_doc: AriesDidDoc, thread_id: String) -> Self { - Self { did_doc, thread_id } - } -} - -impl TheirDidDoc for Responded { - fn their_did_doc(&self) -> &AriesDidDoc { - &self.did_doc - } -} - -impl ThreadId for Responded { - fn thread_id(&self) -> &str { - &self.thread_id - } -} diff --git a/aries_vcx/src/protocols/connection/serializable.rs b/aries_vcx/src/protocols/connection/serializable.rs index ff696020ba..d4370c686b 100644 --- a/aries_vcx/src/protocols/connection/serializable.rs +++ b/aries_vcx/src/protocols/connection/serializable.rs @@ -10,7 +10,6 @@ use crate::protocols::connection::{ inviter::states::{ completed::Completed as InviterCompleted, initial::Initial as InviterInitial, invited::Invited as InviterInvited, requested::Requested as InviterRequested, - responded::Responded as InviterResponded, }, pairwise_info::PairwiseInfo, Connection, @@ -64,7 +63,6 @@ pub enum RefInviterState<'a> { Initial(&'a InviterInitial), Invited(&'a InviterInvited), Requested(&'a InviterRequested), - Responded(&'a InviterResponded), Completed(&'a InviterCompleted), } @@ -95,7 +93,6 @@ from_concrete_to_serializable!(Invitee, RefInviteeState, Invitee, RefState); from_concrete_to_serializable!(InviterInitial, Initial, RefInviterState); from_concrete_to_serializable!(InviterInvited, Invited, RefInviterState); from_concrete_to_serializable!(InviterRequested, Requested, RefInviterState); -from_concrete_to_serializable!(InviterResponded, Responded, RefInviterState); from_concrete_to_serializable!(InviterCompleted, Completed, RefInviterState); from_concrete_to_serializable!(InviteeInitial, Initial, RefInviteeState); diff --git a/libvcx_core/src/api_vcx/api_handle/connection.rs b/libvcx_core/src/api_vcx/api_handle/connection.rs index 0d73e48008..5395faf01d 100644 --- a/libvcx_core/src/api_vcx/api_handle/connection.rs +++ b/libvcx_core/src/api_vcx/api_handle/connection.rs @@ -333,7 +333,6 @@ pub async fn send_response(handle: u32) -> LibvcxResult<()> { let response = con.get_connection_response_msg(); con.send_message(&get_main_wallet()?, &response.into(), &HttpClient) .await?; - let con = con.mark_response_sent()?; insert_connection(handle, con) } diff --git a/uniffi_aries_vcx/core/src/handlers/connection/connection.rs b/uniffi_aries_vcx/core/src/handlers/connection/connection.rs index e634a966f6..e3aa48e154 100644 --- a/uniffi_aries_vcx/core/src/handlers/connection/connection.rs +++ b/uniffi_aries_vcx/core/src/handlers/connection/connection.rs @@ -153,9 +153,8 @@ impl Connection { connection .send_message(&profile.inner.inject_wallet(), &response.into(), &HttpClient) .await?; - let new_conn = connection.mark_response_sent()?; - *handler = VcxGenericConnection::from(new_conn); + *handler = VcxGenericConnection::from(connection); Ok(()) }) diff --git a/wrappers/node/src/api/common.ts b/wrappers/node/src/api/common.ts index bb11d4f993..4dbd1cdbe4 100644 --- a/wrappers/node/src/api/common.ts +++ b/wrappers/node/src/api/common.ts @@ -121,7 +121,6 @@ export enum ConnectionStateType { Initial = 0, Invited = 1, Requested = 2, - Responded = 3, Finished = 4, } From b531f2faf02bcdc4ae29f9466f2867e4f9e2b052 Mon Sep 17 00:00:00 2001 From: Patrik Stas Date: Tue, 22 Aug 2023 09:52:22 +0200 Subject: [PATCH 03/10] Distinguish mediated/non-mediated connection state in NodeJS, rename files Signed-off-by: Patrik Stas --- agents/node/vcxagent-core/package.json | 6 ++--- agents/node/vcxagent-core/src/agent.js | 2 +- ...ons.js => service-mediated-connections.js} | 0 ...-connection.spec.js => connection.spec.js} | 0 ...ated-endpoint.spec.js => endpoint.spec.js} | 0 agents/node/vcxagent-core/test/utils/utils.js | 24 +++++++++---------- wrappers/node/src/api/common.ts | 10 +++++++- wrappers/node/src/api/mediated-connection.ts | 6 ++--- .../test/suite1/ariesvcx-connection.test.ts | 2 +- .../ariesvcx-mediated-connection.test.ts | 12 +++++----- 10 files changed, 35 insertions(+), 27 deletions(-) rename agents/node/vcxagent-core/src/services/{service-nonmediated-connections.js => service-mediated-connections.js} (100%) rename agents/node/vcxagent-core/test/{nonmediated-connection.spec.js => connection.spec.js} (100%) rename agents/node/vcxagent-core/test/{nonmediated-endpoint.spec.js => endpoint.spec.js} (100%) diff --git a/agents/node/vcxagent-core/package.json b/agents/node/vcxagent-core/package.json index 1c2fa34c1b..b919c3611f 100644 --- a/agents/node/vcxagent-core/package.json +++ b/agents/node/vcxagent-core/package.json @@ -35,7 +35,7 @@ "demo:faber:mysql": "node demo/faber.js --mysql", "demo:alice:sign": "node demo/alice-signature.js", "demo:faber:verify": "node demo/faber-verify-signature.js", - "test:integration": "npm run test:integration:issue-verify && npm run test:integration:signing && npm run test:integration:messaging && npm run test:integration:tails && npm run test:integration:trustping && npm run test:integration:feature-discovery && npm run test:integration:public-invite && npm run test:integration:out-of-band && npm run test:integration:nonmediated-endpoint && npm run test:integration:nonmediated-connection", + "test:integration": "npm run test:integration:issue-verify && npm run test:integration:signing && npm run test:integration:messaging && npm run test:integration:tails && npm run test:integration:trustping && npm run test:integration:feature-discovery && npm run test:integration:public-invite && npm run test:integration:out-of-band && npm run test:integration:endpoint && npm run test:integration:connection", "test:integration:issue-verify": "jest --forceExit --env=node --runInBand test/issue-verify.spec.js", "test:integration:signing": "jest --forceExit --env=node --runInBand test/sign-verify.spec.js", "test:integration:messaging": "jest --forceExit --env=node --runInBand test/messaging.spec.js", @@ -44,8 +44,8 @@ "test:integration:feature-discovery": "jest --forceExit --env=node --runInBand test/feature-discovery.spec.js", "test:integration:public-invite": "jest --forceExit --env=node --runInBand test/public-invite.spec.js", "test:integration:out-of-band": "jest --forceExit --env=node --runInBand test/out-of-band.spec.js", - "test:integration:nonmediated-endpoint": "jest --forceExit --env=node --runInBand test/nonmediated-endpoint.spec.js", - "test:integration:nonmediated-connection": "jest --forceExit --env=node --runInBand test/nonmediated-connection.spec.js" + "test:integration:endpoint": "jest --forceExit --env=node --runInBand test/endpoint.spec.js", + "test:integration:connection": "jest --forceExit --env=node --runInBand test/connection.spec.js" }, "dependencies": { "@hyperledger/node-vcx-wrapper": "file:../../../wrappers/node", diff --git a/agents/node/vcxagent-core/src/agent.js b/agents/node/vcxagent-core/src/agent.js index e2eae35506..b1997a0b7b 100644 --- a/agents/node/vcxagent-core/src/agent.js +++ b/agents/node/vcxagent-core/src/agent.js @@ -9,7 +9,7 @@ const { createServiceProver } = require('./services/service-prover') const { createServiceCredHolder } = require('./services/service-cred-holder') const { createServiceCredIssuer } = require('./services/service-cred-issuer') const { createServiceConnections } = require('./services/service-connections') -const { createServiceNonmediatedConnections } = require('./services/service-nonmediated-connections') +const { createServiceNonmediatedConnections } = require('./services/service-mediated-connections') const { createServiceOutOfBand } = require('./services/service-out-of-band') const { createServiceLedgerRevocationRegistry } = require('./services/service-revocation-registry') const { provisionAgentInAgency } = require('./utils/vcx-workflows') diff --git a/agents/node/vcxagent-core/src/services/service-nonmediated-connections.js b/agents/node/vcxagent-core/src/services/service-mediated-connections.js similarity index 100% rename from agents/node/vcxagent-core/src/services/service-nonmediated-connections.js rename to agents/node/vcxagent-core/src/services/service-mediated-connections.js diff --git a/agents/node/vcxagent-core/test/nonmediated-connection.spec.js b/agents/node/vcxagent-core/test/connection.spec.js similarity index 100% rename from agents/node/vcxagent-core/test/nonmediated-connection.spec.js rename to agents/node/vcxagent-core/test/connection.spec.js diff --git a/agents/node/vcxagent-core/test/nonmediated-endpoint.spec.js b/agents/node/vcxagent-core/test/endpoint.spec.js similarity index 100% rename from agents/node/vcxagent-core/test/nonmediated-endpoint.spec.js rename to agents/node/vcxagent-core/test/endpoint.spec.js diff --git a/agents/node/vcxagent-core/test/utils/utils.js b/agents/node/vcxagent-core/test/utils/utils.js index 269da83d73..7416633341 100644 --- a/agents/node/vcxagent-core/test/utils/utils.js +++ b/agents/node/vcxagent-core/test/utils/utils.js @@ -3,8 +3,8 @@ const sleep = require('sleep-promise') const express = require('express') const { createFaber } = require('./faber') const { createAlice } = require('./alice') -const { ConnectionStateType } = require('@hyperledger/node-vcx-wrapper') const assert = require('assert') +const { MediatedConnectionStateType } = require('../../../../../wrappers/node/src') const logger = require('../../demo/logger')('utils') module.exports.createAliceAndFaber = async function createAliceAndFaber ({ aliceEndpoint, faberEndpoint } = {}) { @@ -18,9 +18,9 @@ module.exports.createPairedAliceAndFaber = async function createPairedAliceAndFa const faber = await createFaber() const invite = await faber.createInvite() await alice.acceptInvite(invite) - await faber.updateConnection(ConnectionStateType.Responded) - await alice.updateConnection(ConnectionStateType.Finished) - await faber.updateConnection(ConnectionStateType.Finished) + await faber.updateConnection(MediatedConnectionStateType.Responded) + await alice.updateConnection(MediatedConnectionStateType.Finished) + await faber.updateConnection(MediatedConnectionStateType.Finished) return { alice, faber } } @@ -69,8 +69,8 @@ module.exports.createPairedAliceAndFaberViaPublicInvite = async function createP } const f2 = async (alice, faber, pwInfo, message) => { await faber.createConnectionFromReceivedRequestV2(pwInfo, message) - await alice.updateConnection(ConnectionStateType.Finished) - await faber.updateConnection(ConnectionStateType.Finished) + await alice.updateConnection(MediatedConnectionStateType.Finished) + await faber.updateConnection(MediatedConnectionStateType.Finished) return { alice, faber } } return await executeFunctionWithServer(f1, f2) @@ -83,13 +83,13 @@ module.exports.createPairedAliceAndFaberViaOobMsg = async function createPairedA const pwInfo = await faber.publishService(endpoint) const msg = await faber.createOobMessageWithDid() await alice.createConnectionUsingOobMessage(msg) - await alice.updateConnection(ConnectionStateType.Requested) + await alice.updateConnection(MediatedConnectionStateType.Requested) return { alice, faber, pwInfo } } const f2 = async (alice, faber, pwInfo, message) => { await faber.createConnectionFromReceivedRequestV2(pwInfo, message) - await alice.updateConnection(ConnectionStateType.Finished) - await faber.updateConnection(ConnectionStateType.Finished) + await alice.updateConnection(MediatedConnectionStateType.Finished) + await faber.updateConnection(MediatedConnectionStateType.Finished) return { alice, faber } } return await executeFunctionWithServer(f1, f2) @@ -99,13 +99,13 @@ module.exports.connectViaOobMessage = async function connectViaOobMessage (alice const f1 = async (endpoint) => { const pwInfo = await faber.publishService(endpoint) await alice.createConnectionUsingOobMessage(msg) - await alice.updateConnection(ConnectionStateType.Requested) + await alice.updateConnection(MediatedConnectionStateType.Requested) return { alice, faber, pwInfo } } const f2 = async (alice, faber, pwInfo, message) => { await faber.createConnectionFromReceivedRequestV2(pwInfo, message) - await alice.updateConnection(ConnectionStateType.Finished) - await faber.updateConnection(ConnectionStateType.Finished) + await alice.updateConnection(MediatedConnectionStateType.Finished) + await faber.updateConnection(MediatedConnectionStateType.Finished) return { alice, faber } } return await executeFunctionWithServer(f1, f2) diff --git a/wrappers/node/src/api/common.ts b/wrappers/node/src/api/common.ts index 4dbd1cdbe4..10873d0ed7 100644 --- a/wrappers/node/src/api/common.ts +++ b/wrappers/node/src/api/common.ts @@ -117,13 +117,21 @@ export enum VCXCode { UNIMPLEMENTED_FEATURE = 1117, LEDGER_ITEM_NOT_FOUND = 1118, } -export enum ConnectionStateType { +export enum MediatedConnectionStateType { Initial = 0, Invited = 1, + Responded = 3, Requested = 2, Finished = 4, } +export enum ConnectionStateType { + Initial = 0, + Invited = 1, + Requested = 2, + Finished = 4, +} + export enum HolderStateType { Initial= 0, ProposalSent = 1, diff --git a/wrappers/node/src/api/mediated-connection.ts b/wrappers/node/src/api/mediated-connection.ts index a9d3097676..ab6857667d 100644 --- a/wrappers/node/src/api/mediated-connection.ts +++ b/wrappers/node/src/api/mediated-connection.ts @@ -1,6 +1,6 @@ import * as ffiNapi from '@hyperledger/vcx-napi-rs'; import { VCXInternalError } from '../errors'; -import { ISerializedData, ConnectionStateType } from './common'; +import { ISerializedData, MediatedConnectionStateType } from './common'; import { VcxBaseWithState } from './vcx-base-with-state'; import { IPwInfo } from './utils'; @@ -14,7 +14,7 @@ export interface IConnectionData { endpoint: string; uuid: string; wallet: string; - state: ConnectionStateType; + state: MediatedConnectionStateType; } /** @@ -122,7 +122,7 @@ export function generatePublicInvite(public_did: string, label: string): string } } -export class Connection extends VcxBaseWithState { +export class Connection extends VcxBaseWithState { public static async create({ id }: IConnectionCreateData): Promise { try { const connection = new Connection(); diff --git a/wrappers/node/test/suite1/ariesvcx-connection.test.ts b/wrappers/node/test/suite1/ariesvcx-connection.test.ts index 89f7e7f0ee..bb78907e48 100644 --- a/wrappers/node/test/suite1/ariesvcx-connection.test.ts +++ b/wrappers/node/test/suite1/ariesvcx-connection.test.ts @@ -2,7 +2,7 @@ import '../module-resolver-helper'; import { assert, expect } from 'chai'; import { initVcxTestMode } from 'helpers/utils'; -import { ConnectionStateType } from 'src'; +import {ConnectionStateType } from 'src'; import { NonmediatedConnection } from 'src'; describe('Nonmediated connection:', () => { diff --git a/wrappers/node/test/suite1/ariesvcx-mediated-connection.test.ts b/wrappers/node/test/suite1/ariesvcx-mediated-connection.test.ts index d4a70c3d9a..6658a12b9e 100644 --- a/wrappers/node/test/suite1/ariesvcx-mediated-connection.test.ts +++ b/wrappers/node/test/suite1/ariesvcx-mediated-connection.test.ts @@ -9,8 +9,8 @@ import { dataConnectionCreate, } from 'helpers/entities'; import { initVcxTestMode, shouldThrow } from 'helpers/utils'; -import { Connection, ConnectionStateType, VCXCode } from 'src'; -import { ARIES_PING, ARIES_PING_RESPONSE, ARIES_UNKNOWN_TYPE } from '../helpers/mockdata'; +import { Connection, MediatedConnectionStateType, VCXCode } from 'src'; +import { ARIES_PING, ARIES_PING_RESPONSE } from '../helpers/mockdata'; describe('Connection:', () => { before(() => initVcxTestMode()); @@ -123,15 +123,15 @@ describe('Connection:', () => { assert.isNotNull(caught_error); }); - it(`returns ${ConnectionStateType.Initial}: not connected`, async () => { + it(`returns ${MediatedConnectionStateType.Initial}: not connected`, async () => { const connection = await connectionCreateInviterNull({ id: 'alice' }); await connection.updateState(); - assert.equal(await connection.getState(), ConnectionStateType.Initial); + assert.equal(await connection.getState(), MediatedConnectionStateType.Initial); }); - it(`returns ${ConnectionStateType.Finished}: mocked accepted`, async () => { + it(`returns ${MediatedConnectionStateType.Finished}: mocked accepted`, async () => { const connection = await createConnectionInviterFinished(); - assert.equal(await connection.getState(), ConnectionStateType.Finished); + assert.equal(await connection.getState(), MediatedConnectionStateType.Finished); }); }); From 02e4763da3e55e139cf904603eac17e3d477bfd8 Mon Sep 17 00:00:00 2001 From: Patrik Stas Date: Tue, 22 Aug 2023 12:00:46 +0200 Subject: [PATCH 04/10] Fix nodejs Signed-off-by: Patrik Stas --- agents/node/vcxagent-core/test/utils/utils.js | 2 +- wrappers/node/src/api/common.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/agents/node/vcxagent-core/test/utils/utils.js b/agents/node/vcxagent-core/test/utils/utils.js index 7416633341..fb9ba80ebd 100644 --- a/agents/node/vcxagent-core/test/utils/utils.js +++ b/agents/node/vcxagent-core/test/utils/utils.js @@ -4,7 +4,7 @@ const express = require('express') const { createFaber } = require('./faber') const { createAlice } = require('./alice') const assert = require('assert') -const { MediatedConnectionStateType } = require('../../../../../wrappers/node/src') +const { MediatedConnectionStateType } = require('@hyperledger/node-vcx-wrapper') const logger = require('../../demo/logger')('utils') module.exports.createAliceAndFaber = async function createAliceAndFaber ({ aliceEndpoint, faberEndpoint } = {}) { diff --git a/wrappers/node/src/api/common.ts b/wrappers/node/src/api/common.ts index 10873d0ed7..a746ef92ac 100644 --- a/wrappers/node/src/api/common.ts +++ b/wrappers/node/src/api/common.ts @@ -126,14 +126,14 @@ export enum MediatedConnectionStateType { } export enum ConnectionStateType { - Initial = 0, - Invited = 1, - Requested = 2, - Finished = 4, + Initial = 0, + Invited = 1, + Requested = 2, + Finished = 4, } export enum HolderStateType { - Initial= 0, + Initial = 0, ProposalSent = 1, OfferReceived = 2, RequestSent = 3, @@ -169,7 +169,7 @@ export enum VerifierStateType { PresentationProposalReceived = 2, PresentationRequestSent = 3, Finished = 4, - Failed = 5 + Failed = 5, } export interface ISerializedData { From 7d493ad1793a3fe859cce11edd990284079bef12 Mon Sep 17 00:00:00 2001 From: Patrik Stas Date: Tue, 22 Aug 2023 14:19:36 +0200 Subject: [PATCH 05/10] Fix nodejs Signed-off-by: Patrik Stas --- agents/node/vcxagent-core/test/utils/faber.js | 8 ++++---- agents/node/vcxagent-core/test/utils/utils.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/agents/node/vcxagent-core/test/utils/faber.js b/agents/node/vcxagent-core/test/utils/faber.js index 7a7c0352cc..c3cc72ccec 100644 --- a/agents/node/vcxagent-core/test/utils/faber.js +++ b/agents/node/vcxagent-core/test/utils/faber.js @@ -1,7 +1,7 @@ /* eslint-env jest */ const { createVcxAgent, getSampleSchemaData } = require('../../src') const { - ConnectionStateType, IssuerStateType, VerifierStateType, generatePublicInvite, + MediatedConnectionStateType, ConnectionStateType, IssuerStateType, VerifierStateType, generatePublicInvite, createService, getServiceFromLedger, unpack, createAndStoreDid } = require('@hyperledger/node-vcx-wrapper') const { getAliceSchemaAttrs, getFaberCredDefName } = require('./data') @@ -300,7 +300,7 @@ module.exports.createFaber = async function createFaber (serviceEndpoint = 'http await vcxAgent.agentInitVcx() expect(await vcxAgent.serviceNonmediatedConnections.getState(connectionId)).toBe(ConnectionStateType.Invited) await vcxAgent.serviceNonmediatedConnections.inviterConnectionProcessRequest(connectionId, request) - expect(await vcxAgent.serviceNonmediatedConnections.getState(connectionId)).toBe(ConnectionStateType.Responded) + expect(await vcxAgent.serviceNonmediatedConnections.getState(connectionId)).toBe(ConnectionStateType.Requested) await vcxAgent.agentShutdownVcx() } @@ -310,7 +310,7 @@ module.exports.createFaber = async function createFaber (serviceEndpoint = 'http await vcxAgent.agentInitVcx() await vcxAgent.serviceNonmediatedConnections.inviterConnectionCreateFromRequest(connectionId, request, pwInfo) - expect(await vcxAgent.serviceNonmediatedConnections.getState(connectionId)).toBe(ConnectionStateType.Responded) + expect(await vcxAgent.serviceNonmediatedConnections.getState(connectionId)).toBe(ConnectionStateType.Requested) await vcxAgent.agentShutdownVcx() } @@ -330,7 +330,7 @@ module.exports.createFaber = async function createFaber (serviceEndpoint = 'http await vcxAgent.agentInitVcx() await vcxAgent.serviceConnections.inviterConnectionCreateFromRequestV2(connectionId, pwInfo, request) - expect(await vcxAgent.serviceConnections.connectionUpdate(connectionId)).toBe(ConnectionStateType.Responded) + expect(await vcxAgent.serviceConnections.connectionUpdate(connectionId)).toBe(MediatedConnectionStateType.Responded) await vcxAgent.agentShutdownVcx() } diff --git a/agents/node/vcxagent-core/test/utils/utils.js b/agents/node/vcxagent-core/test/utils/utils.js index fb9ba80ebd..e8e70b2e65 100644 --- a/agents/node/vcxagent-core/test/utils/utils.js +++ b/agents/node/vcxagent-core/test/utils/utils.js @@ -4,7 +4,7 @@ const express = require('express') const { createFaber } = require('./faber') const { createAlice } = require('./alice') const assert = require('assert') -const { MediatedConnectionStateType } = require('@hyperledger/node-vcx-wrapper') +const { MediatedConnectionStateType, ConnectionStateType } = require('@hyperledger/node-vcx-wrapper') const logger = require('../../demo/logger')('utils') module.exports.createAliceAndFaber = async function createAliceAndFaber ({ aliceEndpoint, faberEndpoint } = {}) { @@ -70,7 +70,7 @@ module.exports.createPairedAliceAndFaberViaPublicInvite = async function createP const f2 = async (alice, faber, pwInfo, message) => { await faber.createConnectionFromReceivedRequestV2(pwInfo, message) await alice.updateConnection(MediatedConnectionStateType.Finished) - await faber.updateConnection(MediatedConnectionStateType.Finished) + await faber.updateConnection(ConnectionStateType.Finished) return { alice, faber } } return await executeFunctionWithServer(f1, f2) @@ -83,13 +83,13 @@ module.exports.createPairedAliceAndFaberViaOobMsg = async function createPairedA const pwInfo = await faber.publishService(endpoint) const msg = await faber.createOobMessageWithDid() await alice.createConnectionUsingOobMessage(msg) - await alice.updateConnection(MediatedConnectionStateType.Requested) + await alice.updateConnection(MediatedConnectionStateType.Responded) return { alice, faber, pwInfo } } const f2 = async (alice, faber, pwInfo, message) => { await faber.createConnectionFromReceivedRequestV2(pwInfo, message) await alice.updateConnection(MediatedConnectionStateType.Finished) - await faber.updateConnection(MediatedConnectionStateType.Finished) + await faber.updateConnection(ConnectionStateType.Finished) return { alice, faber } } return await executeFunctionWithServer(f1, f2) From 49c5b266d594d256003a50d14b58d949ee4327ce Mon Sep 17 00:00:00 2001 From: Patrik Stas Date: Tue, 22 Aug 2023 18:00:58 +0200 Subject: [PATCH 06/10] Fix nodejs Signed-off-by: Patrik Stas --- agents/node/vcxagent-core/test/utils/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agents/node/vcxagent-core/test/utils/utils.js b/agents/node/vcxagent-core/test/utils/utils.js index e8e70b2e65..d898c6a4a7 100644 --- a/agents/node/vcxagent-core/test/utils/utils.js +++ b/agents/node/vcxagent-core/test/utils/utils.js @@ -83,7 +83,7 @@ module.exports.createPairedAliceAndFaberViaOobMsg = async function createPairedA const pwInfo = await faber.publishService(endpoint) const msg = await faber.createOobMessageWithDid() await alice.createConnectionUsingOobMessage(msg) - await alice.updateConnection(MediatedConnectionStateType.Responded) + await alice.updateConnection(MediatedConnectionStateType.Requested) return { alice, faber, pwInfo } } const f2 = async (alice, faber, pwInfo, message) => { From 6f0095653c2ab2b1ff56594e528aa68a1350021d Mon Sep 17 00:00:00 2001 From: Patrik Stas Date: Tue, 29 Aug 2023 22:52:06 +0200 Subject: [PATCH 07/10] Rename send_request to prepare_request Signed-off-by: Patrik Stas --- agents/rust/aries-vcx-agent/src/services/connection.rs | 2 +- aries_vcx/src/protocols/connection/generic/mod.rs | 2 +- aries_vcx/src/protocols/connection/invitee/mod.rs | 4 ++-- libvcx_core/src/api_vcx/api_handle/connection.rs | 2 +- uniffi_aries_vcx/core/src/handlers/connection/connection.rs | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/agents/rust/aries-vcx-agent/src/services/connection.rs b/agents/rust/aries-vcx-agent/src/services/connection.rs index 59175a3fbd..8c1b5659b0 100644 --- a/agents/rust/aries-vcx-agent/src/services/connection.rs +++ b/agents/rust/aries-vcx-agent/src/services/connection.rs @@ -56,7 +56,7 @@ impl ServiceConnections { pub async fn send_request(&self, thread_id: &str) -> AgentResult<()> { let invitee: Connection<_, _> = self.connections.get(thread_id)?.try_into()?; let invitee = invitee - .send_request( + .prepare_request( &self.profile.inject_wallet(), self.service_endpoint.clone(), vec![], diff --git a/aries_vcx/src/protocols/connection/generic/mod.rs b/aries_vcx/src/protocols/connection/generic/mod.rs index ce9f8cef74..5e65038bb3 100644 --- a/aries_vcx/src/protocols/connection/generic/mod.rs +++ b/aries_vcx/src/protocols/connection/generic/mod.rs @@ -406,7 +406,7 @@ mod connection_serde_tests { make_invitee_invited() .await - .send_request(&wallet, service_endpoint, routing_keys, &MockTransport) + .prepare_request(&wallet, service_endpoint, routing_keys, &MockTransport) .await .unwrap() } diff --git a/aries_vcx/src/protocols/connection/invitee/mod.rs b/aries_vcx/src/protocols/connection/invitee/mod.rs index 747219d614..8743a77368 100644 --- a/aries_vcx/src/protocols/connection/invitee/mod.rs +++ b/aries_vcx/src/protocols/connection/invitee/mod.rs @@ -84,7 +84,7 @@ impl InviteeConnection { /// # Errors /// /// Will error out if sending the request fails. - pub async fn send_request( + pub async fn prepare_request( self, wallet: &Arc, service_endpoint: Url, @@ -94,7 +94,7 @@ impl InviteeConnection { where T: Transport, { - trace!("Connection::send_request"); + trace!("Connection::prepare_request"); let recipient_keys = vec![self.pairwise_info.pw_vk.clone()]; diff --git a/libvcx_core/src/api_vcx/api_handle/connection.rs b/libvcx_core/src/api_vcx/api_handle/connection.rs index 5395faf01d..b9746f07da 100644 --- a/libvcx_core/src/api_vcx/api_handle/connection.rs +++ b/libvcx_core/src/api_vcx/api_handle/connection.rs @@ -341,7 +341,7 @@ pub async fn send_request(handle: u32, service_endpoint: String, routing_keys: V let con = get_cloned_connection(&handle)?; let con = con - .send_request( + .prepare_request( &get_main_wallet()?, Url::from_str(&service_endpoint) .map_err(|err| LibvcxError::from_msg(LibvcxErrorKind::InvalidUrl, err.to_string()))?, diff --git a/uniffi_aries_vcx/core/src/handlers/connection/connection.rs b/uniffi_aries_vcx/core/src/handlers/connection/connection.rs index e3aa48e154..5e8dad6ebe 100644 --- a/uniffi_aries_vcx/core/src/handlers/connection/connection.rs +++ b/uniffi_aries_vcx/core/src/handlers/connection/connection.rs @@ -135,7 +135,7 @@ impl Connection { block_on(async { let new_conn = connection - .send_request(&profile.inner.inject_wallet(), url, routing_keys, &HttpClient) + .prepare_request(&profile.inner.inject_wallet(), url, routing_keys, &HttpClient) .await?; *handler = VcxGenericConnection::from(new_conn); From 9390de3db5aa4d3e67f3cf076244aa658eb62d54 Mon Sep 17 00:00:00 2001 From: Patrik Stas Date: Tue, 29 Aug 2023 23:59:19 +0200 Subject: [PATCH 08/10] Eliminate send methods from Connection Invitee Signed-off-by: Patrik Stas --- .../src/services/connection.rs | 13 ++--- .../connection/generic/conversions.rs | 3 -- .../src/protocols/connection/generic/mod.rs | 28 +++------- .../connection/generic/thin_state.rs | 1 - .../src/protocols/connection/invitee/mod.rs | 54 +++++-------------- .../connection/invitee/states/mod.rs | 1 - .../connection/invitee/states/requested.rs | 10 +++- .../connection/invitee/states/responded.rs | 38 ------------- .../src/protocols/connection/serializable.rs | 3 -- .../src/api_vcx/api_handle/connection.rs | 18 +++---- .../src/handlers/connection/connection.rs | 10 ++-- 11 files changed, 42 insertions(+), 137 deletions(-) delete mode 100644 aries_vcx/src/protocols/connection/invitee/states/responded.rs diff --git a/agents/rust/aries-vcx-agent/src/services/connection.rs b/agents/rust/aries-vcx-agent/src/services/connection.rs index 8c1b5659b0..481ca4a120 100644 --- a/agents/rust/aries-vcx-agent/src/services/connection.rs +++ b/agents/rust/aries-vcx-agent/src/services/connection.rs @@ -56,14 +56,10 @@ impl ServiceConnections { pub async fn send_request(&self, thread_id: &str) -> AgentResult<()> { let invitee: Connection<_, _> = self.connections.get(thread_id)?.try_into()?; let invitee = invitee - .prepare_request( - &self.profile.inject_wallet(), - self.service_endpoint.clone(), - vec![], - &HttpClient, - ) + .prepare_request(self.service_endpoint.clone(), vec![]) + .await?; + invitee.send_message(&self.profile.inject_wallet(), invitee.get_request().into(), &HttpClient) .await?; - self.connections.insert(thread_id, invitee.into())?; Ok(()) } @@ -125,7 +121,8 @@ impl ServiceConnections { pub async fn send_ack(&self, thread_id: &str) -> AgentResult<()> { let invitee: Connection<_, _> = self.connections.get(thread_id)?.try_into()?; - let invitee = invitee.send_ack(&self.profile.inject_wallet(), &HttpClient).await?; + invitee.send_message(&self.profile.inject_wallet(), &invitee.get_ack().into(),&HttpClient) + .await?; self.connections.insert(thread_id, invitee.into())?; diff --git a/aries_vcx/src/protocols/connection/generic/conversions.rs b/aries_vcx/src/protocols/connection/generic/conversions.rs index cea40ac960..dab1985e0d 100644 --- a/aries_vcx/src/protocols/connection/generic/conversions.rs +++ b/aries_vcx/src/protocols/connection/generic/conversions.rs @@ -6,7 +6,6 @@ use crate::{ invitee::states::{ completed::Completed as InviteeCompleted, initial::Initial as InviteeInitial, invited::Invited as InviteeInvited, requested::Requested as InviteeRequested, - responded::Responded as InviteeResponded, }, inviter::states::{ completed::Completed as InviterCompleted, initial::Initial as InviterInitial, @@ -111,7 +110,6 @@ from_concrete_to_vague!(InviterCompleted, Completed, InviterState); from_concrete_to_vague!(InviteeInitial, Initial, InviteeState); from_concrete_to_vague!(InviteeInvited, Invited, InviteeState); from_concrete_to_vague!(InviteeRequested, Requested, InviteeState); -from_concrete_to_vague!(InviteeResponded, Responded, InviteeState); from_concrete_to_vague!(InviteeCompleted, Completed, InviteeState); // ---------------------------- Try From Vague State to Concrete State implementations ---------------------------- @@ -139,5 +137,4 @@ try_from_vague_to_concrete!(InviterState, Completed, InviterCompleted); try_from_vague_to_concrete!(InviteeState, Initial, InviteeInitial); try_from_vague_to_concrete!(InviteeState, Invited, InviteeInvited); try_from_vague_to_concrete!(InviteeState, Requested, InviteeRequested); -try_from_vague_to_concrete!(InviteeState, Responded, InviteeResponded); try_from_vague_to_concrete!(InviteeState, Completed, InviteeCompleted); diff --git a/aries_vcx/src/protocols/connection/generic/mod.rs b/aries_vcx/src/protocols/connection/generic/mod.rs index 5e65038bb3..7bbe97c627 100644 --- a/aries_vcx/src/protocols/connection/generic/mod.rs +++ b/aries_vcx/src/protocols/connection/generic/mod.rs @@ -16,7 +16,6 @@ use crate::{ invitee::states::{ completed::Completed as InviteeCompleted, initial::Initial as InviteeInitial, invited::Invited as InviteeInvited, requested::Requested as InviteeRequested, - responded::Responded as InviteeResponded, }, inviter::states::{ completed::Completed as InviterCompleted, initial::Initial as InviterInitial, @@ -95,7 +94,6 @@ pub enum InviteeState { Initial(InviteeInitial), Invited(InviteeInvited), Requested(InviteeRequested), - Responded(InviteeResponded), Completed(InviteeCompleted), } @@ -112,7 +110,6 @@ impl GenericConnection { GenericState::Invitee(InviteeState::Initial(_)) => None, GenericState::Invitee(InviteeState::Invited(s)) => Some(s.thread_id()), GenericState::Invitee(InviteeState::Requested(s)) => Some(s.thread_id()), - GenericState::Invitee(InviteeState::Responded(s)) => Some(s.thread_id()), GenericState::Invitee(InviteeState::Completed(s)) => Some(s.thread_id()), GenericState::Inviter(InviterState::Initial(_)) => None, GenericState::Inviter(InviterState::Invited(s)) => Some(s.thread_id()), @@ -130,7 +127,6 @@ impl GenericConnection { GenericState::Invitee(InviteeState::Initial(_)) => None, GenericState::Invitee(InviteeState::Invited(s)) => Some(s.their_did_doc()), GenericState::Invitee(InviteeState::Requested(s)) => Some(s.their_did_doc()), - GenericState::Invitee(InviteeState::Responded(s)) => Some(s.their_did_doc()), GenericState::Invitee(InviteeState::Completed(s)) => Some(s.their_did_doc()), GenericState::Inviter(InviterState::Initial(_)) => None, GenericState::Inviter(InviterState::Invited(_)) => None, @@ -145,7 +141,6 @@ impl GenericConnection { GenericState::Invitee(InviteeState::Initial(_)) => None, GenericState::Invitee(InviteeState::Invited(s)) => Some(s.bootstrap_did_doc()), GenericState::Invitee(InviteeState::Requested(s)) => Some(s.bootstrap_did_doc()), - GenericState::Invitee(InviteeState::Responded(s)) => Some(s.bootstrap_did_doc()), GenericState::Invitee(InviteeState::Completed(s)) => Some(s.bootstrap_did_doc()), } } @@ -219,12 +214,10 @@ mod connection_serde_tests { use super::*; use crate::common::signing::sign_connection_response; - use crate::core::profile::profile::Profile; use crate::handlers::util::AnyInvitation; use crate::protocols::connection::serializable::*; use crate::protocols::connection::{invitee::InviteeConnection, inviter::InviterConnection, Connection}; use crate::utils::mockdata::profile::mock_ledger::MockLedger; - use crate::utils::mockdata::profile::mock_profile::MockProfile; use aries_vcx_core::ledger::base_ledger::IndyLedgerRead; use aries_vcx_core::wallet::mock_wallet::MockWallet; use std::sync::Arc; @@ -235,7 +228,6 @@ mod connection_serde_tests { RefInviteeState::Initial(s) => Self::Initial(s.to_owned()), RefInviteeState::Invited(s) => Self::Invited(s.to_owned()), RefInviteeState::Requested(s) => Self::Requested(s.to_owned()), - RefInviteeState::Responded(s) => Self::Responded(s.to_owned()), RefInviteeState::Completed(s) => Self::Completed(s.to_owned()), } } @@ -283,7 +275,6 @@ mod connection_serde_tests { InviteeState::Initial(s) => Self::Initial(s), InviteeState::Invited(s) => Self::Invited(s), InviteeState::Requested(s) => Self::Requested(s), - InviteeState::Responded(s) => Self::Responded(s), InviteeState::Completed(s) => Self::Completed(s), } } @@ -400,18 +391,17 @@ mod connection_serde_tests { } async fn make_invitee_requested() -> InviteeConnection { - let wallet: Arc = Arc::new(MockWallet {}); let service_endpoint = SERVICE_ENDPOINT.parse().unwrap(); let routing_keys = vec![]; make_invitee_invited() .await - .prepare_request(&wallet, service_endpoint, routing_keys, &MockTransport) + .prepare_request(service_endpoint, routing_keys) .await .unwrap() } - async fn make_invitee_responded() -> InviteeConnection { + async fn make_invitee_completed() -> InviteeConnection { let wallet: Arc = Arc::new(MockWallet {}); let con = make_invitee_requested().await; let mut con_data = ConnectionData::new(PW_KEY.to_owned(), AriesDidDoc::default()); @@ -429,17 +419,12 @@ mod connection_serde_tests { let response = Response::with_decorators(Uuid::new_v4().to_string(), content, decorators); - con.handle_response(&wallet, response, &MockTransport).await.unwrap() - } - - async fn make_invitee_completed() -> InviteeConnection { - let wallet: Arc = Arc::new(MockWallet {}); + let con = con.handle_response(&wallet, response, &MockTransport).await.unwrap(); - make_invitee_responded() + con.send_message(&wallet, &con.get_ack().into(), &MockTransport) .await - .send_ack(&wallet, &MockTransport) - .await - .unwrap() + .unwrap(); + con } async fn make_inviter_initial() -> InviterConnection { @@ -499,7 +484,6 @@ mod connection_serde_tests { generate_test!(invitee_connection_initial, make_invitee_initial); generate_test!(invitee_connection_invited, make_invitee_invited); generate_test!(invitee_connection_requested, make_invitee_requested); - generate_test!(invitee_connection_responded, make_invitee_responded); generate_test!(invitee_connection_complete, make_invitee_completed); generate_test!(inviter_connection_initial, make_inviter_initial); diff --git a/aries_vcx/src/protocols/connection/generic/thin_state.rs b/aries_vcx/src/protocols/connection/generic/thin_state.rs index 53842dd411..b7376d5491 100644 --- a/aries_vcx/src/protocols/connection/generic/thin_state.rs +++ b/aries_vcx/src/protocols/connection/generic/thin_state.rs @@ -45,7 +45,6 @@ impl From<&InviteeState> for State { InviteeState::Initial(_) => Self::Initial, InviteeState::Invited(_) => Self::Invited, InviteeState::Requested(_) => Self::Requested, - InviteeState::Responded(_) => Self::Responded, InviteeState::Completed(_) => Self::Completed, } } diff --git a/aries_vcx/src/protocols/connection/invitee/mod.rs b/aries_vcx/src/protocols/connection/invitee/mod.rs index 8743a77368..9c2804c5d2 100644 --- a/aries_vcx/src/protocols/connection/invitee/mod.rs +++ b/aries_vcx/src/protocols/connection/invitee/mod.rs @@ -29,9 +29,7 @@ use crate::{ transport::Transport, }; -use self::states::{ - completed::Completed, initial::Initial, invited::Invited, requested::Requested, responded::Responded, -}; +use self::states::{completed::Completed, initial::Initial, invited::Invited, requested::Requested}; use super::{initiation_type::Invitee, pairwise_info::PairwiseInfo, trait_bounds::BootstrapDidDoc, Connection}; use crate::{ @@ -84,16 +82,11 @@ impl InviteeConnection { /// # Errors /// /// Will error out if sending the request fails. - pub async fn prepare_request( + pub async fn prepare_request( self, - wallet: &Arc, service_endpoint: Url, routing_keys: Vec, - transport: &T, - ) -> VcxResult> - where - T: Transport, - { + ) -> VcxResult> { trace!("Connection::prepare_request"); let recipient_keys = vec![self.pairwise_info.pw_vk.clone()]; @@ -143,10 +136,8 @@ impl InviteeConnection { let request = Request::with_decorators(id, content, decorators); - self.send_message(wallet, &request.into(), transport).await?; - Ok(Connection { - state: Requested::new(self.state.did_doc, thread_id), + state: Requested::new(self.state.did_doc, thread_id, request), source_id: self.source_id, pairwise_info: self.pairwise_info, initiation_type: Invitee, @@ -168,7 +159,7 @@ impl InviteeConnection { wallet: &Arc, response: Response, transport: &T, - ) -> VcxResult> + ) -> VcxResult> where T: Transport, { @@ -203,7 +194,7 @@ impl InviteeConnection { } }?; - let state = Responded::new(did_doc, self.state.did_doc, self.state.thread_id); + let state = Completed::new(did_doc, self.state.did_doc, self.state.thread_id, None); Ok(Connection { state, @@ -212,22 +203,19 @@ impl InviteeConnection { initiation_type: Invitee, }) } + + pub fn get_request(&self) -> &Request { + &self.state.request + } } -impl InviteeConnection { +impl InviteeConnection { /// Sends an acknowledgement message to the inviter and transitions to [`InviteeConnection`]. /// /// # Errors /// /// Will error out if sending the message fails. - pub async fn send_ack( - self, - wallet: &Arc, - transport: &T, - ) -> VcxResult> - where - T: Transport, - { + pub fn get_ack(&self) -> Ack { let id = Uuid::new_v4().to_string(); let content = AckContent::new(AckStatus::Ok); @@ -236,23 +224,7 @@ impl InviteeConnection { timing.out_time = Some(Utc::now()); decorators.timing = Some(timing); - let msg = Ack::with_decorators(id, content, decorators).into(); - - self.send_message(wallet, &msg, transport).await?; - - let state = Completed::new( - self.state.did_doc, - self.state.bootstrap_did_doc, - self.state.thread_id, - None, - ); - - Ok(Connection { - state, - source_id: self.source_id, - pairwise_info: self.pairwise_info, - initiation_type: Invitee, - }) + Ack::with_decorators(id, content, decorators) } } diff --git a/aries_vcx/src/protocols/connection/invitee/states/mod.rs b/aries_vcx/src/protocols/connection/invitee/states/mod.rs index 0cc0ecd220..b0953d0d5a 100644 --- a/aries_vcx/src/protocols/connection/invitee/states/mod.rs +++ b/aries_vcx/src/protocols/connection/invitee/states/mod.rs @@ -2,4 +2,3 @@ pub mod completed; pub mod initial; pub mod invited; pub mod requested; -pub mod responded; diff --git a/aries_vcx/src/protocols/connection/invitee/states/requested.rs b/aries_vcx/src/protocols/connection/invitee/states/requested.rs index 7c6368e4b1..49360b1be7 100644 --- a/aries_vcx/src/protocols/connection/invitee/states/requested.rs +++ b/aries_vcx/src/protocols/connection/invitee/states/requested.rs @@ -1,4 +1,5 @@ use diddoc_legacy::aries::diddoc::AriesDidDoc; +use messages::msg_fields::protocols::connection::request::Request; use crate::protocols::connection::trait_bounds::{BootstrapDidDoc, HandleProblem, TheirDidDoc, ThreadId}; @@ -6,11 +7,16 @@ use crate::protocols::connection::trait_bounds::{BootstrapDidDoc, HandleProblem, pub struct Requested { pub(crate) did_doc: AriesDidDoc, pub(crate) thread_id: String, + pub(crate) request: Request, } impl Requested { - pub fn new(did_doc: AriesDidDoc, thread_id: String) -> Self { - Self { did_doc, thread_id } + pub fn new(did_doc: AriesDidDoc, thread_id: String, request: Request) -> Self { + Self { + did_doc, + thread_id, + request, + } } } diff --git a/aries_vcx/src/protocols/connection/invitee/states/responded.rs b/aries_vcx/src/protocols/connection/invitee/states/responded.rs deleted file mode 100644 index da247a60b9..0000000000 --- a/aries_vcx/src/protocols/connection/invitee/states/responded.rs +++ /dev/null @@ -1,38 +0,0 @@ -use diddoc_legacy::aries::diddoc::AriesDidDoc; - -use crate::protocols::connection::trait_bounds::{BootstrapDidDoc, TheirDidDoc, ThreadId}; - -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] -pub struct Responded { - pub(crate) did_doc: AriesDidDoc, - pub(crate) bootstrap_did_doc: AriesDidDoc, - pub(crate) thread_id: String, -} - -impl Responded { - pub fn new(did_doc: AriesDidDoc, bootstrap_did_doc: AriesDidDoc, thread_id: String) -> Self { - Self { - did_doc, - bootstrap_did_doc, - thread_id, - } - } -} - -impl TheirDidDoc for Responded { - fn their_did_doc(&self) -> &AriesDidDoc { - &self.did_doc - } -} - -impl BootstrapDidDoc for Responded { - fn bootstrap_did_doc(&self) -> &AriesDidDoc { - &self.bootstrap_did_doc - } -} - -impl ThreadId for Responded { - fn thread_id(&self) -> &str { - &self.thread_id - } -} diff --git a/aries_vcx/src/protocols/connection/serializable.rs b/aries_vcx/src/protocols/connection/serializable.rs index d4370c686b..c4ce62bb6c 100644 --- a/aries_vcx/src/protocols/connection/serializable.rs +++ b/aries_vcx/src/protocols/connection/serializable.rs @@ -5,7 +5,6 @@ use crate::protocols::connection::{ invitee::states::{ completed::Completed as InviteeCompleted, initial::Initial as InviteeInitial, invited::Invited as InviteeInvited, requested::Requested as InviteeRequested, - responded::Responded as InviteeResponded, }, inviter::states::{ completed::Completed as InviterCompleted, initial::Initial as InviterInitial, @@ -71,7 +70,6 @@ pub enum RefInviteeState<'a> { Initial(&'a InviteeInitial), Invited(&'a InviteeInvited), Requested(&'a InviteeRequested), - Responded(&'a InviteeResponded), Completed(&'a InviteeCompleted), } @@ -98,7 +96,6 @@ from_concrete_to_serializable!(InviterCompleted, Completed, RefInviterState); from_concrete_to_serializable!(InviteeInitial, Initial, RefInviteeState); from_concrete_to_serializable!(InviteeInvited, Invited, RefInviteeState); from_concrete_to_serializable!(InviteeRequested, Requested, RefInviteeState); -from_concrete_to_serializable!(InviteeResponded, Responded, RefInviteeState); from_concrete_to_serializable!(InviteeCompleted, Completed, RefInviteeState); impl<'a> SerializableConnection<'a> { diff --git a/libvcx_core/src/api_vcx/api_handle/connection.rs b/libvcx_core/src/api_vcx/api_handle/connection.rs index b9746f07da..48807abcf6 100644 --- a/libvcx_core/src/api_vcx/api_handle/connection.rs +++ b/libvcx_core/src/api_vcx/api_handle/connection.rs @@ -340,15 +340,10 @@ pub async fn send_request(handle: u32, service_endpoint: String, routing_keys: V trace!("send_request >>>"); let con = get_cloned_connection(&handle)?; - let con = con - .prepare_request( - &get_main_wallet()?, - Url::from_str(&service_endpoint) - .map_err(|err| LibvcxError::from_msg(LibvcxErrorKind::InvalidUrl, err.to_string()))?, - routing_keys, - &HttpClient, - ) - .await?; + let url = Url::from_str(&service_endpoint) + .map_err(|err| LibvcxError::from_msg(LibvcxErrorKind::InvalidUrl, err.to_string()))?; + let con = con.prepare_request(url, routing_keys).await?; + con.send_message(&get_main_wallet()?, con.get_request().into(), &HttpClient).await?; insert_connection(handle, con) } @@ -357,9 +352,8 @@ pub async fn send_ack(handle: u32) -> LibvcxResult<()> { trace!("send_ack >>>"); let con = get_cloned_connection(&handle)?; - let con = con.send_ack(&get_main_wallet()?, &HttpClient).await?; - - insert_connection(handle, con) + con.send_message(&get_main_wallet()?, &con.get_ack().into(), &HttpClient).await?; + Ok(()) } pub async fn send_generic_message(handle: u32, content: String) -> LibvcxResult<()> { diff --git a/uniffi_aries_vcx/core/src/handlers/connection/connection.rs b/uniffi_aries_vcx/core/src/handlers/connection/connection.rs index 5e8dad6ebe..ee27a1742b 100644 --- a/uniffi_aries_vcx/core/src/handlers/connection/connection.rs +++ b/uniffi_aries_vcx/core/src/handlers/connection/connection.rs @@ -134,11 +134,11 @@ impl Connection { .map_err(|err| AriesVcxError::from_msg(AriesVcxErrorKind::InvalidUrl, err.to_string()))?; block_on(async { - let new_conn = connection - .prepare_request(&profile.inner.inject_wallet(), url, routing_keys, &HttpClient) + let new_conn = connection.prepare_request(url, routing_keys) + .await?; + new_conn.send_message(&profile.inner.inject_wallet(), connection.get_request(), &HttpClient) .await?; *handler = VcxGenericConnection::from(new_conn); - Ok(()) }) } @@ -166,9 +166,7 @@ impl Connection { let connection = VcxConnection::try_from(handler.clone())?; block_on(async { - let new_conn = connection.send_ack(&profile.inner.inject_wallet(), &HttpClient).await?; - *handler = VcxGenericConnection::from(new_conn); - + connection.send_message(&profile.inner.inject_wallet(), &connection.get_ack().into(), &HttpClient).await?; Ok(()) }) } From b57ff31c3c23b583843e495bf2c7a827b8dffdc4 Mon Sep 17 00:00:00 2001 From: Patrik Stas Date: Wed, 30 Aug 2023 00:29:06 +0200 Subject: [PATCH 09/10] Fix compile errs Signed-off-by: Patrik Stas --- libvcx_core/src/api_vcx/api_handle/connection.rs | 3 ++- .../core/src/handlers/connection/connection.rs | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libvcx_core/src/api_vcx/api_handle/connection.rs b/libvcx_core/src/api_vcx/api_handle/connection.rs index 48807abcf6..b0a003ba79 100644 --- a/libvcx_core/src/api_vcx/api_handle/connection.rs +++ b/libvcx_core/src/api_vcx/api_handle/connection.rs @@ -343,7 +343,8 @@ pub async fn send_request(handle: u32, service_endpoint: String, routing_keys: V let url = Url::from_str(&service_endpoint) .map_err(|err| LibvcxError::from_msg(LibvcxErrorKind::InvalidUrl, err.to_string()))?; let con = con.prepare_request(url, routing_keys).await?; - con.send_message(&get_main_wallet()?, con.get_request().into(), &HttpClient).await?; + let request = con.get_request().clone(); + con.send_message(&get_main_wallet()?, &request.into(), &HttpClient).await?; insert_connection(handle, con) } diff --git a/uniffi_aries_vcx/core/src/handlers/connection/connection.rs b/uniffi_aries_vcx/core/src/handlers/connection/connection.rs index ee27a1742b..d503897b51 100644 --- a/uniffi_aries_vcx/core/src/handlers/connection/connection.rs +++ b/uniffi_aries_vcx/core/src/handlers/connection/connection.rs @@ -134,11 +134,12 @@ impl Connection { .map_err(|err| AriesVcxError::from_msg(AriesVcxErrorKind::InvalidUrl, err.to_string()))?; block_on(async { - let new_conn = connection.prepare_request(url, routing_keys) + let mut connection = connection.prepare_request(url, routing_keys) .await?; - new_conn.send_message(&profile.inner.inject_wallet(), connection.get_request(), &HttpClient) + let request = connection.get_request().clone(); + connection.send_message(&profile.inner.inject_wallet(), &request.into(), &HttpClient) .await?; - *handler = VcxGenericConnection::from(new_conn); + *handler = VcxGenericConnection::from(connection); Ok(()) }) } From 11cbec1a951663cb7edff563b9327e490fe63433 Mon Sep 17 00:00:00 2001 From: Patrik Stas Date: Wed, 30 Aug 2023 08:21:49 +0200 Subject: [PATCH 10/10] Reformat Signed-off-by: Patrik Stas --- .../aries-vcx-agent/src/services/connection.rs | 10 +++++----- libvcx_core/src/api_vcx/api_handle/connection.rs | 6 ++++-- .../core/src/handlers/connection/connection.rs | 14 ++++++++++---- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/agents/rust/aries-vcx-agent/src/services/connection.rs b/agents/rust/aries-vcx-agent/src/services/connection.rs index 481ca4a120..5c77366fe9 100644 --- a/agents/rust/aries-vcx-agent/src/services/connection.rs +++ b/agents/rust/aries-vcx-agent/src/services/connection.rs @@ -55,10 +55,9 @@ impl ServiceConnections { pub async fn send_request(&self, thread_id: &str) -> AgentResult<()> { let invitee: Connection<_, _> = self.connections.get(thread_id)?.try_into()?; - let invitee = invitee - .prepare_request(self.service_endpoint.clone(), vec![]) - .await?; - invitee.send_message(&self.profile.inject_wallet(), invitee.get_request().into(), &HttpClient) + let invitee = invitee.prepare_request(self.service_endpoint.clone(), vec![]).await?; + invitee + .send_message(&self.profile.inject_wallet(), invitee.get_request().into(), &HttpClient) .await?; self.connections.insert(thread_id, invitee.into())?; Ok(()) @@ -121,7 +120,8 @@ impl ServiceConnections { pub async fn send_ack(&self, thread_id: &str) -> AgentResult<()> { let invitee: Connection<_, _> = self.connections.get(thread_id)?.try_into()?; - invitee.send_message(&self.profile.inject_wallet(), &invitee.get_ack().into(),&HttpClient) + invitee + .send_message(&self.profile.inject_wallet(), &invitee.get_ack().into(), &HttpClient) .await?; self.connections.insert(thread_id, invitee.into())?; diff --git a/libvcx_core/src/api_vcx/api_handle/connection.rs b/libvcx_core/src/api_vcx/api_handle/connection.rs index b0a003ba79..ca78573787 100644 --- a/libvcx_core/src/api_vcx/api_handle/connection.rs +++ b/libvcx_core/src/api_vcx/api_handle/connection.rs @@ -344,7 +344,8 @@ pub async fn send_request(handle: u32, service_endpoint: String, routing_keys: V .map_err(|err| LibvcxError::from_msg(LibvcxErrorKind::InvalidUrl, err.to_string()))?; let con = con.prepare_request(url, routing_keys).await?; let request = con.get_request().clone(); - con.send_message(&get_main_wallet()?, &request.into(), &HttpClient).await?; + con.send_message(&get_main_wallet()?, &request.into(), &HttpClient) + .await?; insert_connection(handle, con) } @@ -353,7 +354,8 @@ pub async fn send_ack(handle: u32) -> LibvcxResult<()> { trace!("send_ack >>>"); let con = get_cloned_connection(&handle)?; - con.send_message(&get_main_wallet()?, &con.get_ack().into(), &HttpClient).await?; + con.send_message(&get_main_wallet()?, &con.get_ack().into(), &HttpClient) + .await?; Ok(()) } diff --git a/uniffi_aries_vcx/core/src/handlers/connection/connection.rs b/uniffi_aries_vcx/core/src/handlers/connection/connection.rs index d503897b51..ae4bb14f2a 100644 --- a/uniffi_aries_vcx/core/src/handlers/connection/connection.rs +++ b/uniffi_aries_vcx/core/src/handlers/connection/connection.rs @@ -134,10 +134,10 @@ impl Connection { .map_err(|err| AriesVcxError::from_msg(AriesVcxErrorKind::InvalidUrl, err.to_string()))?; block_on(async { - let mut connection = connection.prepare_request(url, routing_keys) - .await?; + let mut connection = connection.prepare_request(url, routing_keys).await?; let request = connection.get_request().clone(); - connection.send_message(&profile.inner.inject_wallet(), &request.into(), &HttpClient) + connection + .send_message(&profile.inner.inject_wallet(), &request.into(), &HttpClient) .await?; *handler = VcxGenericConnection::from(connection); Ok(()) @@ -167,7 +167,13 @@ impl Connection { let connection = VcxConnection::try_from(handler.clone())?; block_on(async { - connection.send_message(&profile.inner.inject_wallet(), &connection.get_ack().into(), &HttpClient).await?; + connection + .send_message( + &profile.inner.inject_wallet(), + &connection.get_ack().into(), + &HttpClient, + ) + .await?; Ok(()) }) }