From d575cc79ef863ef67043fd33cef0117e7cd45c69 Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Tue, 19 Nov 2024 16:09:18 -0700 Subject: [PATCH] Revert "verificationhelper: add callback for when other user reports done" This reverts commit 363fdfa3b2274cb9f4a8b5a5894bdc2e2de410f9. --- crypto/verificationhelper/callbacks_test.go | 11 ----------- crypto/verificationhelper/verificationhelper.go | 7 ------- .../verificationhelper_qr_crosssign_test.go | 2 -- .../verificationhelper_qr_self_test.go | 2 -- .../verificationhelper/verificationhelper_sas_test.go | 1 - 5 files changed, 23 deletions(-) diff --git a/crypto/verificationhelper/callbacks_test.go b/crypto/verificationhelper/callbacks_test.go index cc473f9a..7b1055d1 100644 --- a/crypto/verificationhelper/callbacks_test.go +++ b/crypto/verificationhelper/callbacks_test.go @@ -25,7 +25,6 @@ type baseVerificationCallbacks struct { verificationsRequested map[id.UserID][]id.VerificationTransactionID qrCodesShown map[id.VerificationTransactionID]*verificationhelper.QRCode qrCodesScanned map[id.VerificationTransactionID]struct{} - otherDoneTransactions map[id.VerificationTransactionID]struct{} doneTransactions map[id.VerificationTransactionID]struct{} verificationCancellation map[id.VerificationTransactionID]*event.VerificationCancelEventContent emojisShown map[id.VerificationTransactionID][]rune @@ -37,7 +36,6 @@ func newBaseVerificationCallbacks() *baseVerificationCallbacks { verificationsRequested: map[id.UserID][]id.VerificationTransactionID{}, qrCodesShown: map[id.VerificationTransactionID]*verificationhelper.QRCode{}, qrCodesScanned: map[id.VerificationTransactionID]struct{}{}, - otherDoneTransactions: map[id.VerificationTransactionID]struct{}{}, doneTransactions: map[id.VerificationTransactionID]struct{}{}, verificationCancellation: map[id.VerificationTransactionID]*event.VerificationCancelEventContent{}, emojisShown: map[id.VerificationTransactionID][]rune{}, @@ -62,11 +60,6 @@ func (c *baseVerificationCallbacks) WasOurQRCodeScanned(txnID id.VerificationTra return ok } -func (c *baseVerificationCallbacks) OtherReportedDone(txnID id.VerificationTransactionID) bool { - _, ok := c.otherDoneTransactions[txnID] - return ok -} - func (c *baseVerificationCallbacks) IsVerificationDone(txnID id.VerificationTransactionID) bool { _, ok := c.doneTransactions[txnID] return ok @@ -95,10 +88,6 @@ func (c *baseVerificationCallbacks) VerificationCancelled(ctx context.Context, t } } -func (c *baseVerificationCallbacks) OtherReportsDone(ctx context.Context, txnID id.VerificationTransactionID) { - c.otherDoneTransactions[txnID] = struct{}{} -} - func (c *baseVerificationCallbacks) VerificationDone(ctx context.Context, txnID id.VerificationTransactionID) { c.doneTransactions[txnID] = struct{}{} } diff --git a/crypto/verificationhelper/verificationhelper.go b/crypto/verificationhelper/verificationhelper.go index bad0b006..d3b7d4f5 100644 --- a/crypto/verificationhelper/verificationhelper.go +++ b/crypto/verificationhelper/verificationhelper.go @@ -115,10 +115,6 @@ type RequiredCallbacks interface { // VerificationCancelled is called when the verification is cancelled. VerificationCancelled(ctx context.Context, txnID id.VerificationTransactionID, code event.VerificationCancelCode, reason string) - // OtherReportsDone is called when the other user has reported that the - // verification is done. - OtherReportsDone(ctx context.Context, txnID id.VerificationTransactionID) - // VerificationDone is called when the verification is done. VerificationDone(ctx context.Context, txnID id.VerificationTransactionID) } @@ -156,7 +152,6 @@ type VerificationHelper struct { supportedMethods []event.VerificationMethod verificationRequested func(ctx context.Context, txnID id.VerificationTransactionID, from id.UserID) verificationCancelledCallback func(ctx context.Context, txnID id.VerificationTransactionID, code event.VerificationCancelCode, reason string) - otherReportsDone func(ctx context.Context, txnID id.VerificationTransactionID) verificationDone func(ctx context.Context, txnID id.VerificationTransactionID) showSAS func(ctx context.Context, txnID id.VerificationTransactionID, emojis []rune, decimals []int) @@ -184,7 +179,6 @@ func NewVerificationHelper(client *mautrix.Client, mach *crypto.OlmMachine, call } else { helper.verificationRequested = c.VerificationRequested helper.verificationCancelledCallback = c.VerificationCancelled - helper.otherReportsDone = c.OtherReportsDone helper.verificationDone = c.VerificationDone } @@ -886,7 +880,6 @@ func (vh *VerificationHelper) onVerificationDone(ctx context.Context, txn *verif } txn.ReceivedTheirDone = true - vh.otherReportsDone(ctx, txn.TransactionID) if txn.SentOurDone { delete(vh.activeTransactions, txn.TransactionID) vh.verificationDone(ctx, txn.TransactionID) diff --git a/crypto/verificationhelper/verificationhelper_qr_crosssign_test.go b/crypto/verificationhelper/verificationhelper_qr_crosssign_test.go index 0003410b..aace2230 100644 --- a/crypto/verificationhelper/verificationhelper_qr_crosssign_test.go +++ b/crypto/verificationhelper/verificationhelper_qr_crosssign_test.go @@ -99,7 +99,6 @@ func TestCrossSignVerification_ScanQRAndConfirmScan(t *testing.T) { assert.Equal(t, txnID, doneEvt.TransactionID) ts.dispatchToDevice(t, ctx, sendingClient) - assert.True(t, sendingCallbacks.OtherReportedDone(txnID)) } else { // receiving scans QR // Emulate scanning the QR code shown by the sending device on // the receiving device. @@ -138,7 +137,6 @@ func TestCrossSignVerification_ScanQRAndConfirmScan(t *testing.T) { assert.Equal(t, txnID, doneEvt.TransactionID) ts.dispatchToDevice(t, ctx, receivingClient) - assert.True(t, receivingCallbacks.OtherReportedDone(txnID)) } // Ensure that both devices have marked the verification as done. diff --git a/crypto/verificationhelper/verificationhelper_qr_self_test.go b/crypto/verificationhelper/verificationhelper_qr_self_test.go index 9942ae30..11358b88 100644 --- a/crypto/verificationhelper/verificationhelper_qr_self_test.go +++ b/crypto/verificationhelper/verificationhelper_qr_self_test.go @@ -200,7 +200,6 @@ func TestSelfVerification_ScanQRAndConfirmScan(t *testing.T) { assert.Equal(t, txnID, doneEvt.TransactionID) ts.dispatchToDevice(t, ctx, sendingClient) - assert.True(t, sendingCallbacks.OtherReportedDone(txnID)) } else { // receiving scans QR // Emulate scanning the QR code shown by the sending device on // the receiving device. @@ -239,7 +238,6 @@ func TestSelfVerification_ScanQRAndConfirmScan(t *testing.T) { assert.Equal(t, txnID, doneEvt.TransactionID) ts.dispatchToDevice(t, ctx, receivingClient) - assert.True(t, receivingCallbacks.OtherReportedDone(txnID)) } // Ensure that both devices have marked the verification as done. diff --git a/crypto/verificationhelper/verificationhelper_sas_test.go b/crypto/verificationhelper/verificationhelper_sas_test.go index 4f036f18..20e52e0f 100644 --- a/crypto/verificationhelper/verificationhelper_sas_test.go +++ b/crypto/verificationhelper/verificationhelper_sas_test.go @@ -269,7 +269,6 @@ func TestVerification_SAS(t *testing.T) { // twice to process and drain all of the events. ts.dispatchToDevice(t, ctx, sendingClient) ts.dispatchToDevice(t, ctx, receivingClient) - assert.True(t, receivingCallbacks.OtherReportedDone(txnID)) ts.dispatchToDevice(t, ctx, sendingClient) ts.dispatchToDevice(t, ctx, receivingClient) assert.True(t, sendingCallbacks.IsVerificationDone(txnID))