Skip to content

Commit

Permalink
add send_message
Browse files Browse the repository at this point in the history
  • Loading branch information
swaptr committed Oct 18, 2023
1 parent c7a58d1 commit 973ac96
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions uniffi_aries_vcx/core/src/handlers/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -238,4 +239,22 @@ impl Connection {
Ok(())
})
}

pub fn send_message(
&self,
profile_holder: Arc<ProfileHolder>,
message: String,
) -> VcxUniFFIResult<()> {
let message = serde_json::from_str(&message)?;
let mut handler = self.handler.lock()?;
let connection: VcxConnection<Inviter, Completed> =
VcxConnection::try_from(handler.clone())?;

block_on(async {
connection
.send_message(profile_holder.inner.wallet(), &message, &HttpClient)
.await?;
Ok(())
})
}
}

0 comments on commit 973ac96

Please sign in to comment.