From 4baf8187e10ea67914e06edb37920818d53c5f59 Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Sat, 17 Jun 2023 21:02:03 +0200 Subject: [PATCH] feat: Remove the KEX timestamp from the double ratchet data --- lib/src/double_ratchet/double_ratchet.dart | 13 +------------ lib/src/omemo/omemo.dart | 2 -- test/double_ratchet_test.dart | 2 -- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/lib/src/double_ratchet/double_ratchet.dart b/lib/src/double_ratchet/double_ratchet.dart index 9c3fcb6..9f33a1f 100644 --- a/lib/src/double_ratchet/double_ratchet.dart +++ b/lib/src/double_ratchet/double_ratchet.dart @@ -70,7 +70,6 @@ class OmemoDoubleRatchet { this.sessionAd, this.mkSkipped, // MKSKIPPED this.acknowledged, - this.kexTimestamp, this.kex, ); @@ -104,10 +103,6 @@ class OmemoDoubleRatchet { /// List of skipped message keys. final Map> mkSkipped; - /// The point in time at which we performed the kex exchange to create this ratchet. - /// Precision is milliseconds since epoch. - int kexTimestamp; - /// The key exchange that was used for initiating the session. final KeyExchangeData kex; @@ -126,7 +121,6 @@ class OmemoDoubleRatchet { OmemoPublicKey ek, List sk, List ad, - int timestamp, int pkId, ) async { final dhs = await OmemoKeyPair.generateNewPair(KeyPairType.x25519); @@ -145,7 +139,6 @@ class OmemoDoubleRatchet { ad, {}, false, - timestamp, KeyExchangeData( pkId, spkId, @@ -167,7 +160,6 @@ class OmemoDoubleRatchet { OmemoPublicKey ek, List sk, List ad, - int kexTimestamp, ) async { return OmemoDoubleRatchet( spk, @@ -182,7 +174,6 @@ class OmemoDoubleRatchet { ad, {}, true, - kexTimestamp, KeyExchangeData( pkId, spkId, @@ -384,7 +375,6 @@ class OmemoDoubleRatchet { sessionAd, Map>.from(mkSkipped), acknowledged, - kexTimestamp, kex, ); } @@ -426,7 +416,6 @@ class OmemoDoubleRatchet { ns == other.ns && nr == other.nr && pn == other.pn && - listsEqual(sessionAd, other.sessionAd) && - kexTimestamp == other.kexTimestamp; + listsEqual(sessionAd, other.sessionAd); } } diff --git a/lib/src/omemo/omemo.dart b/lib/src/omemo/omemo.dart index ea1e7c7..6e31cb8 100644 --- a/lib/src/omemo/omemo.dart +++ b/lib/src/omemo/omemo.dart @@ -431,7 +431,6 @@ class OmemoManager { kexEk, kex.sk, kex.ad, - getTimestamp(), ); final keyAndHmac = await ratchet.ratchetDecrypt( @@ -672,7 +671,6 @@ class OmemoManager { kexResult.ek.pk, kexResult.sk, kexResult.ad, - getTimestamp(), kexResult.opkId, ); diff --git a/test/double_ratchet_test.dart b/test/double_ratchet_test.dart index f630bae..e4137d6 100644 --- a/test/double_ratchet_test.dart +++ b/test/double_ratchet_test.dart @@ -58,7 +58,6 @@ void main() { resultAlice.ek.pk, resultAlice.sk, resultAlice.ad, - 0, resultAlice.opkId, ); final bobsRatchet = await OmemoDoubleRatchet.acceptNewSession( @@ -69,7 +68,6 @@ void main() { resultAlice.ek.pk, resultBob.sk, resultBob.ad, - 0, ); expect(alicesRatchet.sessionAd, bobsRatchet.sessionAd);