Don't promote archived sessions, more logging on error
This commit is contained in:
parent
1098e59f87
commit
5369950c1d
7 changed files with 161 additions and 48 deletions
|
@ -775,6 +775,7 @@ class MessageReceiverInner extends EventTarget {
|
|||
return promise.catch(error => {
|
||||
window.log.error(
|
||||
`queueDecryptedEnvelope error handling envelope ${id}:`,
|
||||
error && error.extra ? JSON.stringify(error.extra) : '',
|
||||
error && error.stack ? error.stack : error
|
||||
);
|
||||
});
|
||||
|
@ -796,6 +797,7 @@ class MessageReceiverInner extends EventTarget {
|
|||
'queueEnvelope error handling envelope',
|
||||
this.getEnvelopeId(envelope),
|
||||
':',
|
||||
error && error.extra ? JSON.stringify(error.extra) : '',
|
||||
error && error.stack ? error.stack : error,
|
||||
];
|
||||
if (error.warn) {
|
||||
|
@ -2044,8 +2046,11 @@ class MessageReceiverInner extends EventTarget {
|
|||
address
|
||||
);
|
||||
|
||||
window.log.info('deleting sessions for', address.toString());
|
||||
return sessionCipher.deleteAllSessionsForDevice();
|
||||
window.log.info(
|
||||
'handleEndSession: closing sessions for',
|
||||
address.toString()
|
||||
);
|
||||
return sessionCipher.closeOpenSessionForDevice();
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
|
@ -589,14 +589,19 @@ export default class OutgoingMessage {
|
|||
identifier: string,
|
||||
deviceIdsToRemove: Array<number>
|
||||
): Promise<void> {
|
||||
let promise = Promise.resolve();
|
||||
for (const j in deviceIdsToRemove) {
|
||||
promise = promise.then(async () => {
|
||||
const encodedAddress = `${identifier}.${deviceIdsToRemove[j]}`;
|
||||
return window.textsecure.storage.protocol.removeSession(encodedAddress);
|
||||
});
|
||||
}
|
||||
return promise;
|
||||
await Promise.all(
|
||||
deviceIdsToRemove.map(async deviceId => {
|
||||
const address = new window.libsignal.SignalProtocolAddress(
|
||||
identifier,
|
||||
deviceId
|
||||
);
|
||||
const sessionCipher = new window.libsignal.SessionCipher(
|
||||
window.textsecure.storage.protocol,
|
||||
address
|
||||
);
|
||||
await sessionCipher.closeOpenSessionForDevice();
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
async sendToIdentifier(providedIdentifier: string): Promise<void> {
|
||||
|
|
|
@ -1574,7 +1574,7 @@ export default class MessageSender {
|
|||
): Promise<
|
||||
CallbackResultType | void | Array<CallbackResultType | void | Array<void>>
|
||||
> {
|
||||
window.log.info('resetting secure session');
|
||||
window.log.info('resetSession: start');
|
||||
const silent = false;
|
||||
const proto = new window.textsecure.protobuf.DataMessage();
|
||||
proto.body = 'TERMINATE';
|
||||
|
@ -1587,7 +1587,7 @@ export default class MessageSender {
|
|||
window.log.error(prefix, error && error.stack ? error.stack : error);
|
||||
throw error;
|
||||
};
|
||||
const deleteAllSessions = async (targetIdentifier: string) =>
|
||||
const closeAllSessions = async (targetIdentifier: string) =>
|
||||
window.textsecure.storage.protocol
|
||||
.getDeviceIds(targetIdentifier)
|
||||
.then(async deviceIds =>
|
||||
|
@ -1597,21 +1597,24 @@ export default class MessageSender {
|
|||
targetIdentifier,
|
||||
deviceId
|
||||
);
|
||||
window.log.info('deleting sessions for', address.toString());
|
||||
window.log.info(
|
||||
'resetSession: closing sessions for',
|
||||
address.toString()
|
||||
);
|
||||
const sessionCipher = new window.libsignal.SessionCipher(
|
||||
window.textsecure.storage.protocol,
|
||||
address
|
||||
);
|
||||
return sessionCipher.deleteAllSessionsForDevice();
|
||||
return sessionCipher.closeOpenSessionForDevice();
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
const sendToContactPromise = deleteAllSessions(identifier)
|
||||
.catch(logError('resetSession/deleteAllSessions1 error:'))
|
||||
const sendToContactPromise = closeAllSessions(identifier)
|
||||
.catch(logError('resetSession/closeAllSessions1 error:'))
|
||||
.then(async () => {
|
||||
window.log.info(
|
||||
'finished closing local sessions, now sending to contact'
|
||||
'resetSession: finished closing local sessions, now sending to contact'
|
||||
);
|
||||
return this.sendIndividualProto(
|
||||
identifier,
|
||||
|
@ -1622,8 +1625,8 @@ export default class MessageSender {
|
|||
).catch(logError('resetSession/sendToContact error:'));
|
||||
})
|
||||
.then(async () =>
|
||||
deleteAllSessions(identifier).catch(
|
||||
logError('resetSession/deleteAllSessions2 error:')
|
||||
closeAllSessions(identifier).catch(
|
||||
logError('resetSession/closeAllSessions2 error:')
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -326,7 +326,7 @@
|
|||
"rule": "jQuery-load(",
|
||||
"path": "js/signal_protocol_store.js",
|
||||
"line": " await ConversationController.load();",
|
||||
"lineNumber": 983,
|
||||
"lineNumber": 1019,
|
||||
"reasonCategory": "falseMatch",
|
||||
"updated": "2020-06-12T14:20:09.936Z"
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue