Add a BOB test-case around session closure

This commit is contained in:
Matt Corallo 2014-07-24 17:11:53 -04:00
parent a6426194ef
commit 6f3ee151f3
3 changed files with 143 additions and 2 deletions

View file

@ -149,9 +149,10 @@ window.textsecure.crypto = function() {
var sessions = device.sessions;
var doDeleteSession = false;
if (session.indexInfo.closed == -1)
if (session.indexInfo.closed == -1 || device.identityKey === undefined)
device.identityKey = session.indexInfo.remoteIdentityKey;
else {
if (session.indexInfo.closed != -1) {
doDeleteSession = (session.indexInfo.closed < (new Date().getTime() - MESSAGE_LOST_THRESHOLD_MS));
if (!doDeleteSession) {
@ -463,6 +464,8 @@ window.textsecure.crypto = function() {
}
var closeSession = function(session) {
if (session.indexInfo.closed > -1)
return;
// Clear any data which would allow session continuation:
// Lock down current receive ratchet
for (var key in session)