feat: Remove the KEX timestamp from the double ratchet data

This commit is contained in:
PapaTutuWawa 2023-06-17 21:02:03 +02:00
parent fe2b090ea0
commit 4baf8187e1
3 changed files with 1 additions and 16 deletions

View File

@ -70,7 +70,6 @@ class OmemoDoubleRatchet {
this.sessionAd, this.sessionAd,
this.mkSkipped, // MKSKIPPED this.mkSkipped, // MKSKIPPED
this.acknowledged, this.acknowledged,
this.kexTimestamp,
this.kex, this.kex,
); );
@ -104,10 +103,6 @@ class OmemoDoubleRatchet {
/// List of skipped message keys. /// List of skipped message keys.
final Map<SkippedKey, List<int>> mkSkipped; final Map<SkippedKey, List<int>> 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. /// The key exchange that was used for initiating the session.
final KeyExchangeData kex; final KeyExchangeData kex;
@ -126,7 +121,6 @@ class OmemoDoubleRatchet {
OmemoPublicKey ek, OmemoPublicKey ek,
List<int> sk, List<int> sk,
List<int> ad, List<int> ad,
int timestamp,
int pkId, int pkId,
) async { ) async {
final dhs = await OmemoKeyPair.generateNewPair(KeyPairType.x25519); final dhs = await OmemoKeyPair.generateNewPair(KeyPairType.x25519);
@ -145,7 +139,6 @@ class OmemoDoubleRatchet {
ad, ad,
{}, {},
false, false,
timestamp,
KeyExchangeData( KeyExchangeData(
pkId, pkId,
spkId, spkId,
@ -167,7 +160,6 @@ class OmemoDoubleRatchet {
OmemoPublicKey ek, OmemoPublicKey ek,
List<int> sk, List<int> sk,
List<int> ad, List<int> ad,
int kexTimestamp,
) async { ) async {
return OmemoDoubleRatchet( return OmemoDoubleRatchet(
spk, spk,
@ -182,7 +174,6 @@ class OmemoDoubleRatchet {
ad, ad,
{}, {},
true, true,
kexTimestamp,
KeyExchangeData( KeyExchangeData(
pkId, pkId,
spkId, spkId,
@ -384,7 +375,6 @@ class OmemoDoubleRatchet {
sessionAd, sessionAd,
Map<SkippedKey, List<int>>.from(mkSkipped), Map<SkippedKey, List<int>>.from(mkSkipped),
acknowledged, acknowledged,
kexTimestamp,
kex, kex,
); );
} }
@ -426,7 +416,6 @@ class OmemoDoubleRatchet {
ns == other.ns && ns == other.ns &&
nr == other.nr && nr == other.nr &&
pn == other.pn && pn == other.pn &&
listsEqual(sessionAd, other.sessionAd) && listsEqual(sessionAd, other.sessionAd);
kexTimestamp == other.kexTimestamp;
} }
} }

View File

@ -431,7 +431,6 @@ class OmemoManager {
kexEk, kexEk,
kex.sk, kex.sk,
kex.ad, kex.ad,
getTimestamp(),
); );
final keyAndHmac = await ratchet.ratchetDecrypt( final keyAndHmac = await ratchet.ratchetDecrypt(
@ -672,7 +671,6 @@ class OmemoManager {
kexResult.ek.pk, kexResult.ek.pk,
kexResult.sk, kexResult.sk,
kexResult.ad, kexResult.ad,
getTimestamp(),
kexResult.opkId, kexResult.opkId,
); );

View File

@ -58,7 +58,6 @@ void main() {
resultAlice.ek.pk, resultAlice.ek.pk,
resultAlice.sk, resultAlice.sk,
resultAlice.ad, resultAlice.ad,
0,
resultAlice.opkId, resultAlice.opkId,
); );
final bobsRatchet = await OmemoDoubleRatchet.acceptNewSession( final bobsRatchet = await OmemoDoubleRatchet.acceptNewSession(
@ -69,7 +68,6 @@ void main() {
resultAlice.ek.pk, resultAlice.ek.pk,
resultBob.sk, resultBob.sk,
resultBob.ad, resultBob.ad,
0,
); );
expect(alicesRatchet.sessionAd, bobsRatchet.sessionAd); expect(alicesRatchet.sessionAd, bobsRatchet.sessionAd);