Fix Verification getting stuck
Related: connect2x/trixnity-messenger/trixnity-messenger#613 (closed)
When two trixnity clients verify one another, verification fails.
Changes:
- We wait until we have both their and our SasMacEventContent before signing and sending VerificationDone
- Ensure we send and handle events in the correct order
Analysis:
- When we receive SasMacEventContent, we send VerificationDone
- When we sendAndHandle VerificationDone, we update our state to Done/WaitForDone
- When we later sendAndHandle our own SasMacEventContent, our state is already at Done/WaitForDone
- Handling SasMacEventContent requires our state to be at ComparisonByUser or WaitForMac
The process looks something like this:
-
handleVerificationStep(SasMacEventContent, isOurOwn=false)— Receive their event - __
sendVerificationStepAndHandleIt(VerificationDoneEventContent) - ____
handleVerificationStep(VerificationDoneEventContent, isOurOwn=true) - ______
state = WaitForDone— update state - ____
sendVerificationStep(VerificationDoneEventContent) -
match()— send our event - __
sendVerificationStepAndHandleIt(SasMacEventContent) - ____
handleVerificationStep(SasMacEventContent, isOurOwn=true) - ______
if (currentState is ComparisonByUser || currentState is WaitForMacs)— precondition fails
Edited by Janne Mareike Koschinski