From 5b739aaf1a81ac46f917f1bc2bbc6f414a1dbc0b Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Mon, 8 Aug 2022 15:50:00 +0200 Subject: [PATCH] fix: Do not keep the old SPK signature --- lib/src/omemo/device.dart | 14 ++------------ test/omemo_test.dart | 1 - 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/lib/src/omemo/device.dart b/lib/src/omemo/device.dart index c07b114..f74c2e2 100644 --- a/lib/src/omemo/device.dart +++ b/lib/src/omemo/device.dart @@ -19,7 +19,6 @@ class Device { this.spkSignature, this.oldSpk, this.oldSpkId, - this.oldSpkSignature, this.opks, ); @@ -41,7 +40,6 @@ class Device { 'old_spk': 'base/64/encoded', 'old_spk_pub': 'base/64/encoded', 'old_spk_id': 122, - 'old_ spk_sig': 'base/64/encoded', 'opks': [ { 'id': 0, @@ -81,7 +79,6 @@ class Device { KeyPairType.x25519, ), data['old_spk_id'] as int?, - base64DecodeIfNotNull(data, 'old_spk_sig'), opks, ); } @@ -99,7 +96,7 @@ class Device { opks[i] = await OmemoKeyPair.generateNewPair(KeyPairType.x25519); } - return Device(jid, id, ik, spk, spkId, signature, null, null, null, opks); + return Device(jid, id, ik, spk, spkId, signature, null, null, opks); } /// Our bare Jid @@ -120,10 +117,8 @@ class Device { /// The old Signed Prekey... final OmemoKeyPair? oldSpk; - /// its Id, ... + /// ...and its Id final int? oldSpkId; - /// ...and its signature - final List? oldSpkSignature; /// Map of an id to the associated Onetime-Prekey final Map opks; @@ -143,7 +138,6 @@ class Device { spkSignature, oldSpk, oldSpkId, - oldSpkSignature, opks, ); } @@ -165,7 +159,6 @@ class Device { newSignature, spk, spkId, - spkSignature, opks, ); } @@ -213,7 +206,6 @@ class Device { 'old_spk': base64EncodeIfNotNull(await oldSpk?.sk.getBytes()), 'old_spk_pub': base64EncodeIfNotNull(await oldSpk?.pk.getBytes()), 'old_spk_id': oldSpkId, - 'old_spk_sig': base64EncodeIfNotNull(oldSpkSignature), 'opks': serialisedOpks, }; } @@ -239,7 +231,6 @@ class Device { final spkMatch = await spk.equals(other.spk); // ignore: invalid_use_of_visible_for_testing_member final oldSpkMatch = oldSpk != null ? await oldSpk!.equals(other.oldSpk!) : other.oldSpk == null; - final oldSpkSigsMatch = oldSpkSignature != null ? listsEqual(oldSpkSignature!, other.oldSpkSignature!) : other.oldSpkSignature == null; return id == other.id && ikMatch && spkMatch && @@ -248,7 +239,6 @@ class Device { listsEqual(spkSignature, other.spkSignature) && spkId == other.spkId && oldSpkId == other.oldSpkId && - oldSpkSigsMatch && opksMatch; } } diff --git a/test/omemo_test.dart b/test/omemo_test.dart index a66cc8d..57f581d 100644 --- a/test/omemo_test.dart +++ b/test/omemo_test.dart @@ -247,7 +247,6 @@ void main() { expect(await newDevice!.oldSpk!.equals(oldDevice.spk), true); expect(newDevice!.oldSpkId, oldDevice.spkId); - expect(listsEqual(newDevice!.oldSpkSignature!, oldDevice.spkSignature), true); }); test('Test accepting a session with an old SPK', () async {