2 Commits

3 changed files with 19 additions and 14 deletions

View File

@@ -20,3 +20,13 @@
- Add `isRatchetAcknowledged` - Add `isRatchetAcknowledged`
- Ratchets that are created due to accepting a kex are now unacknowledged - Ratchets that are created due to accepting a kex are now unacknowledged
## 0.3.0
- Implement enabling and disabling ratchets via the TrustManager interface
- Fix deserialization of the various objects
- Remove the BTBV TrustManager's loadState method. Just use the constructor
- Allow removing all ratchets for a given Jid
- If an error occurs while decrypting the message, the ratchet will now be reset to its prior state
- Fix a bug within the Varint encoding function. This should fix some occasional UnknownSignedPrekeyExceptions
- Remove OmemoSessionManager's toJson and fromJson. Use toJsonWithoutSessions and fromJsonWithoutSessions. Restoring sessions is not out-of-scope for that function

View File

@@ -97,12 +97,7 @@ class OmemoSessionManager {
/// Returns our own device. /// Returns our own device.
Future<Device> getDevice() async { Future<Device> getDevice() async {
Device? dev; return _deviceLock.synchronized(() => _device);
await _deviceLock.synchronized(() async {
dev = _device;
});
return dev!;
} }
/// Returns the id attribute of our own device. This is just a short-hand for /// Returns the id attribute of our own device. This is just a short-hand for
@@ -177,14 +172,14 @@ class OmemoSessionManager {
Future<void> _addSessionFromKeyExchange(String jid, int deviceId, OmemoKeyExchange kex) async { Future<void> _addSessionFromKeyExchange(String jid, int deviceId, OmemoKeyExchange kex) async {
// Pick the correct SPK // Pick the correct SPK
final device = await getDevice(); final device = await getDevice();
OmemoKeyPair? spk; final spk = await _lock.synchronized(() async {
await _lock.synchronized(() async {
if (kex.spkId == _device.spkId) { if (kex.spkId == _device.spkId) {
spk = _device.spk; return _device.spk;
} else if (kex.spkId == _device.oldSpkId) { } else if (kex.spkId == _device.oldSpkId) {
spk = _device.oldSpk; return _device.oldSpk;
} }
return null;
}); });
if (spk == null) { if (spk == null) {
throw UnknownSignedPrekeyException(); throw UnknownSignedPrekeyException();
@@ -196,12 +191,12 @@ class OmemoSessionManager {
OmemoPublicKey.fromBytes(kex.ek!, KeyPairType.x25519), OmemoPublicKey.fromBytes(kex.ek!, KeyPairType.x25519),
kex.pkId!, kex.pkId!,
), ),
spk!, spk,
device.opks.values.elementAt(kex.pkId!), device.opks.values.elementAt(kex.pkId!),
device.ik, device.ik,
); );
final ratchet = await OmemoDoubleRatchet.acceptNewSession( final ratchet = await OmemoDoubleRatchet.acceptNewSession(
spk!, spk,
OmemoPublicKey.fromBytes(kex.ik!, KeyPairType.ed25519), OmemoPublicKey.fromBytes(kex.ik!, KeyPairType.ed25519),
kexResult.sk, kexResult.sk,
kexResult.ad, kexResult.ad,

View File

@@ -1,6 +1,6 @@
name: omemo_dart name: omemo_dart
description: An XMPP library independent OMEMO library description: An XMPP library independent OMEMO library
version: 0.2.1 version: 0.3.0
homepage: https://github.com/PapaTutuWawa/omemo_dart homepage: https://github.com/PapaTutuWawa/omemo_dart
publish_to: https://git.polynom.me/api/packages/PapaTutuWawa/pub publish_to: https://git.polynom.me/api/packages/PapaTutuWawa/pub