fix: Hopefully fix all tests being flaky
It seems that the varint encoding function would not work for some integers as input. This should in theory fix this issue. Since the SPK IDs are randomly between 0 and 2**32 - 1, it makes sense that the tests fail only sometimes.
This commit is contained in:
@@ -177,15 +177,17 @@ class OmemoSessionManager {
|
||||
// Pick the correct SPK
|
||||
final device = await getDevice();
|
||||
OmemoKeyPair? spk;
|
||||
if (kex.spkId == device.spkId) {
|
||||
spk = device.spk;
|
||||
} else if (kex.spkId == device.oldSpkId) {
|
||||
spk = device.oldSpk;
|
||||
} else {
|
||||
|
||||
await _lock.synchronized(() async {
|
||||
if (kex.spkId == _device.spkId) {
|
||||
spk = _device.spk;
|
||||
} else if (kex.spkId == _device.oldSpkId) {
|
||||
spk = _device.oldSpk;
|
||||
}
|
||||
});
|
||||
if (spk == null) {
|
||||
throw UnknownSignedPrekeyException();
|
||||
}
|
||||
|
||||
assert(spk != null, 'The used SPK must be found');
|
||||
|
||||
final kexResult = await x3dhFromInitialMessage(
|
||||
X3DHMessage(
|
||||
@@ -198,7 +200,7 @@ class OmemoSessionManager {
|
||||
device.ik,
|
||||
);
|
||||
final ratchet = await OmemoDoubleRatchet.acceptNewSession(
|
||||
spk,
|
||||
spk!,
|
||||
OmemoPublicKey.fromBytes(kex.ik!, KeyPairType.ed25519),
|
||||
kexResult.sk,
|
||||
kexResult.ad,
|
||||
|
||||
Reference in New Issue
Block a user