diff --git a/uniffi_aries_vcx/core/src/handlers/connection.rs b/uniffi_aries_vcx/core/src/handlers/connection.rs index a39e8f20b5..d34738a8b6 100644 --- a/uniffi_aries_vcx/core/src/handlers/connection.rs +++ b/uniffi_aries_vcx/core/src/handlers/connection.rs @@ -4,6 +4,7 @@ use aries_vcx::{ core::profile::profile::Profile, errors::error::{AriesVcxError, AriesVcxErrorKind}, protocols::connection::{ + initiation_type::Inviter, inviter::states::completed::Completed, pairwise_info::PairwiseInfo, Connection as VcxConnection, GenericConnection as VcxGenericConnection, ThinState, }, @@ -238,4 +239,22 @@ impl Connection { Ok(()) }) } + + pub fn send_message( + &self, + profile_holder: Arc, + message: String, + ) -> VcxUniFFIResult<()> { + let message = serde_json::from_str(&message)?; + let mut handler = self.handler.lock()?; + let connection: VcxConnection = + VcxConnection::try_from(handler.clone())?; + + block_on(async { + connection + .send_message(profile_holder.inner.wallet(), &message, &HttpClient) + .await?; + Ok(()) + }) + } }