From 9276eff1db69a52a761721709cd5fd1617098747 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 28 Sep 2019 21:52:07 +0200 Subject: [PATCH] delete omemo keys when deleting account --- .../siacs/conversations/crypto/axolotl/AxolotlService.java | 7 +++++++ .../conversations/services/XmppConnectionService.java | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java index b804f4222..59ff20fe5 100644 --- a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java @@ -839,6 +839,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 getCryptoTargets(Conversation conversation) { final List jids; if (conversation.getMode() == Conversation.MODE_SINGLE) { diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 68db573a9..cacb1404e 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -2199,6 +2199,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) { @@ -2209,7 +2210,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)) {