feat: Track the old Signed Prekey after rotation

This commit is contained in:
2022-08-08 15:32:08 +02:00
parent 9c23721904
commit b8b6bbf800
6 changed files with 95 additions and 21 deletions

View File

@@ -244,5 +244,9 @@ void main() {
expect(await oldDevice.equals(newDevice!), false);
expect(await newDevice!.equals(await aliceSession.getDevice()), true);
expect(await newDevice!.oldSpk!.equals(oldDevice.spk), true);
expect(newDevice!.oldSpkId, oldDevice.spkId);
expect(listsEqual(newDevice!.oldSpkSignature!, oldDevice.spkSignature), true);
});
}

View File

@@ -12,6 +12,16 @@ void main() {
expect(await oldDevice.equals(newDevice), true);
});
test('Test serialising and deserialising the Device after rotating the SPK', () async {
// Generate a random session
final oldSession = await OmemoSessionManager.generateNewIdentity('user@test.server', opkAmount: 1);
final oldDevice = await (await oldSession.getDevice()).replaceSignedPrekey();
final serialised = await oldDevice.toJson();
final newDevice = Device.fromJson(serialised);
expect(await oldDevice.equals(newDevice), true);
});
test('Test serialising and deserialising the OmemoDoubleRatchet', () async {
// Generate a random ratchet
const aliceJid = 'alice@server.example';