feat: Add getDeviceId and getDeviceBundle

This commit is contained in:
2022-08-18 15:30:31 +02:00
parent ee7b09bdb0
commit d5d4aa9014
4 changed files with 55 additions and 43 deletions

View File

@@ -103,6 +103,18 @@ class OmemoSessionManager {
return dev!;
}
/// Returns the id attribute of our own device. This is just a short-hand for
/// ```await (session.getDevice()).id```.
Future<int> getDeviceId() async {
return _deviceLock.synchronized(() => _device.id);
}
/// Returns the device as an OmemoBundle. This is just a short-hand for
/// ```await (await session.getDevice()).toBundle()```.
Future<OmemoBundle> getDeviceBundle() async {
return _deviceLock.synchronized(() async => _device.toBundle());
}
/// Add a session [ratchet] with the [deviceId] to the internal tracking state.
Future<void> _addSession(String jid, int deviceId, OmemoDoubleRatchet ratchet) async {