Skip to content

Commit

Permalink
Added extraction of thread_id from Thread
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Mircea <[email protected]>
  • Loading branch information
bobozaur committed Sep 13, 2023
1 parent 5b1637c commit 66eaf07
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 26 deletions.
23 changes: 8 additions & 15 deletions aries_vcx/src/protocols/connection/invitee/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,27 +119,20 @@ impl InviteeConnection<Invited> {
// When the invitation is Pairwise, it is designed to be sent to a single invitee.
// In this case, we reuse the invitation ID (current thread ID) as the thread ID
// in both the connection and the request.
let (thread_id, thread) = match &self.state.invitation {
AnyInvitation::Oob(invite) => {
let thread = Thread::builder().thid(id.clone()).pthid(invite.id.clone()).build();
(id.clone(), thread)
}
let thread = match &self.state.invitation {
AnyInvitation::Oob(invite) => Thread::builder().thid(id.clone()).pthid(invite.id.clone()).build(),
AnyInvitation::Con(invite) => match invite.content {
InvitationContent::Public(_) => {
let thread = Thread::builder()
.thid(id.clone())
.pthid(self.state.thread_id().to_owned())
.build();

(id.clone(), thread)
}
InvitationContent::Public(_) => Thread::builder()
.thid(id.clone())
.pthid(self.state.thread_id().to_owned())
.build(),
InvitationContent::Pairwise(_) | InvitationContent::PairwiseDID(_) => {
let thread = Thread::builder().thid(self.state.thread_id().to_owned()).build();
(self.state.thread_id().to_owned(), thread)
Thread::builder().thid(self.state.thread_id().to_owned()).build()
}
},
};

let thread_id = thread.thid.clone();
let decorators = decorators.thread(thread).build();

let request = Request::builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,25 +230,19 @@ impl SmConnectionInvitee {

let decorators = RequestDecorators::builder().timing(Timing::builder().out_time(Utc::now()).build());

let (thread_id, thread) = match &state.invitation {
AnyInvitation::Oob(invite) => {
let thread = Thread::builder().thid(id.clone()).pthid(invite.id.clone()).build();

(id.clone(), thread)
}
let thread = match &state.invitation {
AnyInvitation::Oob(invite) => Thread::builder().thid(id.clone()).pthid(invite.id.clone()).build(),
AnyInvitation::Con(invite) => match invite.content {
InvitationContent::Public(_) => {
let thread = Thread::builder().thid(id.clone()).pthid(self.thread_id.clone()).build();

(id.clone(), thread)
Thread::builder().thid(id.clone()).pthid(self.thread_id.clone()).build()
}
InvitationContent::Pairwise(_) | InvitationContent::PairwiseDID(_) => {
let thread = Thread::builder().thid(self.thread_id.clone()).build();
(self.thread_id.clone(), thread)
Thread::builder().thid(self.thread_id.clone()).build()
}
},
};

let thread_id = thread.thid.clone();
let decorators = decorators.thread(thread).build();

let request = Request::builder()
Expand Down

0 comments on commit 66eaf07

Please sign in to comment.