From d7054f4b630486a03cb0f87e4ba3efef9f00c2b9 Mon Sep 17 00:00:00 2001 From: lilia Date: Mon, 19 Jun 2017 12:26:00 -0700 Subject: [PATCH] Archive sessions whenever an identity key changes Sessions established with the previous identity should no longer be used for sending, so we should close them. Since we've added this call to saveIdentity, we can omit the call to it after profile fetches. // FREEBIE --- js/models/conversations.js | 6 +----- js/signal_protocol_store.js | 4 +++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/js/models/conversations.js b/js/models/conversations.js index f944f29d4..9d75325d1 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -569,11 +569,7 @@ return textsecure.storage.protocol.saveIdentity( id, identityKey, false - ).then(function(isIdentityChange) { - if (isIdentityChange) { - return textsecure.storage.protocol.archiveAllSessions(id); - } - }); + ); }); }, diff --git a/js/signal_protocol_store.js b/js/signal_protocol_store.js index 981d12af1..c987022ab 100644 --- a/js/signal_protocol_store.js +++ b/js/signal_protocol_store.js @@ -457,7 +457,9 @@ nonblockingApproval : nonblockingApproval, }).then(function() { this.trigger('keychange', identifier); - resolve(true); + this.archiveAllSessions(identifier).then(function() { + resolve(true); + }, reject); }.bind(this)); } else if (this.isNonBlockingApprovalRequired(identityRecord)) { console.log("Setting approval status...");