feat: Allow access to the device map
This commit is contained in:
parent
d0986a4608
commit
a4589b6e09
@ -387,11 +387,20 @@ class OmemoSessionManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@visibleForTesting
|
/// Returns the device map, i.e. the mapping of bare Jid to its device identifiers
|
||||||
OmemoDoubleRatchet getRatchet(String jid, int deviceId) => _ratchetMap[RatchetMapKey(jid, deviceId)]!;
|
/// we have built sessions with.
|
||||||
|
Future<Map<String, List<int>>> getDeviceMap() async {
|
||||||
|
Map<String, List<int>>? map;
|
||||||
|
|
||||||
|
await _lock.synchronized(() async {
|
||||||
|
map = _deviceMap;
|
||||||
|
});
|
||||||
|
|
||||||
|
return map!;
|
||||||
|
}
|
||||||
|
|
||||||
@visibleForTesting
|
@visibleForTesting
|
||||||
Map<String, List<int>> getDeviceMap() => _deviceMap;
|
OmemoDoubleRatchet getRatchet(String jid, int deviceId) => _ratchetMap[RatchetMapKey(jid, deviceId)]!;
|
||||||
|
|
||||||
@visibleForTesting
|
@visibleForTesting
|
||||||
Map<RatchetMapKey, OmemoDoubleRatchet> getRatchetMap() => _ratchetMap;
|
Map<RatchetMapKey, OmemoDoubleRatchet> getRatchetMap() => _ratchetMap;
|
||||||
|
@ -93,7 +93,7 @@ void main() {
|
|||||||
final oldDevice = await oldSession.getDevice();
|
final oldDevice = await oldSession.getDevice();
|
||||||
final newDevice = await newSession.getDevice();
|
final newDevice = await newSession.getDevice();
|
||||||
expect(await oldDevice.equals(newDevice), true);
|
expect(await oldDevice.equals(newDevice), true);
|
||||||
expect(oldSession.getDeviceMap(), newSession.getDeviceMap());
|
expect(await oldSession.getDeviceMap(), await newSession.getDeviceMap());
|
||||||
|
|
||||||
expect(oldSession.getRatchetMap().length, newSession.getRatchetMap().length);
|
expect(oldSession.getRatchetMap().length, newSession.getRatchetMap().length);
|
||||||
for (final session in oldSession.getRatchetMap().entries) {
|
for (final session in oldSession.getRatchetMap().entries) {
|
||||||
|
Loading…
Reference in New Issue
Block a user