processVerifiedMessage: Archive all sessions when key changes

FREEBIE
pull/749/head
Scott Nonnenberg 8 years ago
parent 827addf628
commit 7bfb66b13b

@ -111,13 +111,13 @@
}.bind(this)).then(function() { }.bind(this)).then(function() {
this.addVerifiedChange(this.id, verified === VERIFIED, {local: !options.viaSyncMessage}); this.addVerifiedChange(this.id, verified === VERIFIED, {local: !options.viaSyncMessage});
if (!options.viaSyncMessage) { if (!options.viaSyncMessage) {
this.sendVerifySyncMessage(this.id, verified); return this.sendVerifySyncMessage(this.id, verified);
} }
}.bind(this)); }.bind(this));
}, },
sendVerifySyncMessage: function(number, state) { sendVerifySyncMessage: function(number, state) {
textsecure.storage.protocol.loadIdentityKey(number).then(function(key) { textsecure.storage.protocol.loadIdentityKey(number).then(function(key) {
textsecure.messaging.syncVerification(number, state, key); return textsecure.messaging.syncVerification(number, state, key);
}); });
}, },
isVerified: function() { isVerified: function() {

@ -606,17 +606,20 @@
|| (isPresent && !isEqual) || (isPresent && !isEqual)
|| (isPresent && identityRecord.get('verified') !== VerifiedStatus.VERIFIED))) { || (isPresent && identityRecord.get('verified') !== VerifiedStatus.VERIFIED))) {
if (!isPresent || !isEqual) {
this.trigger('keychange', identifier);
}
textsecure.storage.protocol.saveIdentityWithAttributes(identifier, { textsecure.storage.protocol.saveIdentityWithAttributes(identifier, {
publicKey : publicKey, publicKey : publicKey,
verified : verifiedStatus, verified : verifiedStatus,
firstUse : false, firstUse : false,
timestamp : Date.now(), timestamp : Date.now(),
nonblockingApproval : true nonblockingApproval : true
}).then(resolve, reject); }).then(function() {
if (!isPresent || !isEqual) {
this.trigger('keychange', identifier);
return this.archiveAllSessions(identifier).then(resolve, reject);
}
return resolve();
}.bind(this), reject);
} }
}.bind(this)); }.bind(this));
}.bind(this)); }.bind(this));

Loading…
Cancel
Save