Archive sessions on key changes after profile fetch
// FREEBIE
This commit is contained in:
parent
4232f5711c
commit
3acfda3a56
2 changed files with 16 additions and 2 deletions
|
@ -589,8 +589,12 @@
|
||||||
var identityKey = dcodeIO.ByteBuffer.wrap(profile.identityKey, 'base64').toArrayBuffer();
|
var identityKey = dcodeIO.ByteBuffer.wrap(profile.identityKey, 'base64').toArrayBuffer();
|
||||||
|
|
||||||
return textsecure.storage.protocol.saveIdentity(
|
return textsecure.storage.protocol.saveIdentity(
|
||||||
id, identityKey, false
|
id, identityKey, false
|
||||||
);
|
).then(function(isIdentityChange) {
|
||||||
|
if (isIdentityChange) {
|
||||||
|
return textsecure.storage.protocol.archiveAllSessions(id);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -338,6 +338,16 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
archiveAllSessions: function(number) {
|
||||||
|
return this.getDeviceIds(number).then(function(deviceIds) {
|
||||||
|
return Promise.all(deviceIds.map(function(deviceId) {
|
||||||
|
var address = new libsignal.SignalProtocolAddress(number, deviceId);
|
||||||
|
console.log('closing session for', address.toString());
|
||||||
|
var sessionCipher = new libsignal.SessionCipher(textsecure.storage.protocol, address);
|
||||||
|
return sessionCipher.closeOpenSessionForDevice();
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
},
|
||||||
clearSessionStore: function() {
|
clearSessionStore: function() {
|
||||||
return new Promise(function(resolve) {
|
return new Promise(function(resolve) {
|
||||||
var sessions = new SessionCollection();
|
var sessions = new SessionCollection();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue