Compare commits
No commits in common. "b4c14a9769796872f89541ce1fcb383523f2f380" and "3d8c82fe5b512c5e0c39e6893d3cefaa80d7c816" have entirely different histories.
b4c14a9769
...
3d8c82fe5b
@ -140,7 +140,7 @@ class Device {
|
|||||||
|
|
||||||
return Device(
|
return Device(
|
||||||
jid,
|
jid,
|
||||||
this.id,
|
id,
|
||||||
ik,
|
ik,
|
||||||
spk,
|
spk,
|
||||||
spkId,
|
spkId,
|
||||||
|
@ -415,7 +415,7 @@ class OmemoSessionManager {
|
|||||||
|
|
||||||
await _lock.synchronized(() async {
|
await _lock.synchronized(() async {
|
||||||
// Get devices for jid
|
// Get devices for jid
|
||||||
final devices = _deviceMap[jid] ?? [];
|
final devices = _deviceMap[jid]!;
|
||||||
|
|
||||||
for (final deviceId in devices) {
|
for (final deviceId in devices) {
|
||||||
final ratchet = _ratchetMap[RatchetMapKey(jid, deviceId)]!;
|
final ratchet = _ratchetMap[RatchetMapKey(jid, deviceId)]!;
|
||||||
|
@ -12,36 +12,6 @@ void main() {
|
|||||||
print('${record.level.name}: ${record.message}');
|
print('${record.level.name}: ${record.message}');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Test replacing a onetime prekey', () async {
|
|
||||||
const aliceJid = 'alice@server.example';
|
|
||||||
final device = await Device.generateNewDevice(aliceJid, opkAmount: 1);
|
|
||||||
|
|
||||||
final newDevice = await device.replaceOnetimePrekey(0);
|
|
||||||
|
|
||||||
expect(device.jid, newDevice.jid);
|
|
||||||
expect(device.id, newDevice.id);
|
|
||||||
|
|
||||||
var opksMatch = true;
|
|
||||||
if (newDevice.opks.length != device.opks.length) {
|
|
||||||
opksMatch = false;
|
|
||||||
} else {
|
|
||||||
for (final entry in device.opks.entries) {
|
|
||||||
final m = await newDevice.opks[entry.key]?.equals(entry.value) ?? false;
|
|
||||||
if (!m) opksMatch = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
expect(opksMatch, true);
|
|
||||||
expect(await device.ik.equals(newDevice.ik), true);
|
|
||||||
expect(await device.spk.equals(newDevice.spk), true);
|
|
||||||
|
|
||||||
final oldSpkMatch = device.oldSpk != null ?
|
|
||||||
await device.oldSpk!.equals(newDevice.oldSpk!) :
|
|
||||||
newDevice.oldSpk == null;
|
|
||||||
expect(oldSpkMatch, true);
|
|
||||||
expect(listsEqual(device.spkSignature, newDevice.spkSignature), true);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Test using OMEMO sessions with only one device per user', () async {
|
test('Test using OMEMO sessions with only one device per user', () async {
|
||||||
const aliceJid = 'alice@server.example';
|
const aliceJid = 'alice@server.example';
|
||||||
const bobJid = 'bob@other.server.example';
|
const bobJid = 'bob@other.server.example';
|
||||||
|
Loading…
Reference in New Issue
Block a user