diff options
author | Christian Schneppe <christian.schneppe@pix-art.de> | 2019-09-29 14:06:53 +0200 |
---|---|---|
committer | Christian Schneppe <christian.schneppe@pix-art.de> | 2019-09-29 14:06:53 +0200 |
commit | c5c8ba4f31cf949d242280e09ec4e50f0be59a13 (patch) | |
tree | 0f7d646214594da4f25d74b39d692e45189ad443 /src/main/java | |
parent | f3a821d11e4c7df357c4a83ed8814698f3057601 (diff) |
delete omemo keys when deleting account
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java | 12 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 3 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java index 444bcf717..53b4e4d69 100644 --- a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java +++ b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java @@ -2,11 +2,12 @@ package de.pixart.messenger.crypto.axolotl; import android.os.Bundle; import android.security.KeyChain; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import android.util.Log; import android.util.Pair; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.whispersystems.libsignal.IdentityKey; import org.whispersystems.libsignal.IdentityKeyPair; @@ -839,6 +840,13 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { }); } + public void deleteOmemoIdentity() { + final String node = AxolotlService.PEP_BUNDLES + ":" + getOwnDeviceId(); + final IqPacket deleteBundleNode = mXmppConnectionService.getIqGenerator().deleteNode(node); + mXmppConnectionService.sendIqPacket(account, deleteBundleNode, null); + publishDeviceIdsAndRefineAccessModel(getOwnDeviceIds()); + } + public List<Jid> getCryptoTargets(Conversation conversation) { final List<Jid> jids; if (conversation.getMode() == Conversation.MODE_SINGLE) { diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 55ad48954..2c23b6ed0 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -2489,6 +2489,7 @@ public class XmppConnectionService extends Service { public void deleteAccount(final Account account) { synchronized (this.conversations) { + account.getAxolotlService().deleteOmemoIdentity(); for (final Conversation conversation : conversations) { if (conversation.getAccount() == account) { if (conversation.getMode() == Conversation.MODE_MULTI) { @@ -2501,7 +2502,7 @@ public class XmppConnectionService extends Service { } } if (account.getXmppConnection() != null) { - new Thread(() -> disconnect(account, true)).start(); + new Thread(() -> disconnect(account, false)).start(); } final Runnable runnable = () -> { if (!databaseBackend.deleteAccount(account)) { |