From f1e07c0569ce338864f089b612af040975fbff3c Mon Sep 17 00:00:00 2001 From: George Mulhearn Date: Fri, 3 Feb 2023 09:37:54 +1000 Subject: [PATCH] conn from parts Signed-off-by: George Mulhearn --- .../src/handlers/connection/connection.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/aries_vcx/src/handlers/connection/connection.rs b/aries_vcx/src/handlers/connection/connection.rs index be6e580b62..1c5ba70558 100644 --- a/aries_vcx/src/handlers/connection/connection.rs +++ b/aries_vcx/src/handlers/connection/connection.rs @@ -61,6 +61,24 @@ impl Connection { }) } + pub fn from_parts( + source_id: String, + thread_id: String, + pairwise_info: PairwiseInfo, + state: SmConnectionState, + ) -> Self { + let connection_sm = match state { + SmConnectionState::Inviter(state) => { + SmConnection::Inviter(SmConnectionInviter::from(source_id, thread_id, pairwise_info, state)) + } + SmConnectionState::Invitee(state) => { + SmConnection::Invitee(SmConnectionInvitee::from(source_id, thread_id, pairwise_info, state)) + } + }; + + Self { connection_sm } + } + // ----------------------------- GETTERS ------------------------------------ pub fn get_thread_id(&self) -> String { match &self.connection_sm {