Set messageKeysLimit to unlimited if communicating with our devices (#1348)
Set messageKeysLimit to unlimited if communicating with our devices FREEBIE
This commit is contained in:
parent
7e0bd82bd3
commit
e223db56d9
4 changed files with 88 additions and 14 deletions
|
@ -325,7 +325,17 @@ MessageReceiver.prototype.extend({
|
|||
decrypt: function(envelope, ciphertext) {
|
||||
var promise;
|
||||
var address = new libsignal.SignalProtocolAddress(envelope.source, envelope.sourceDevice);
|
||||
var sessionCipher = new libsignal.SessionCipher(textsecure.storage.protocol, address);
|
||||
|
||||
var ourNumber = textsecure.storage.user.getNumber();
|
||||
var number = address.toString().split('.')[0];
|
||||
var options = {};
|
||||
|
||||
// No limit on message keys if we're communicating with our other devices
|
||||
if (ourNumber === number) {
|
||||
options.messageKeysLimit = false;
|
||||
}
|
||||
|
||||
var sessionCipher = new libsignal.SessionCipher(textsecure.storage.protocol, address, options);
|
||||
switch(envelope.type) {
|
||||
case textsecure.protobuf.Envelope.Type.CIPHERTEXT:
|
||||
console.log('message from', this.getEnvelopeId(envelope));
|
||||
|
@ -635,7 +645,17 @@ MessageReceiver.prototype.extend({
|
|||
},
|
||||
tryMessageAgain: function(from, ciphertext) {
|
||||
var address = libsignal.SignalProtocolAddress.fromString(from);
|
||||
var sessionCipher = new libsignal.SessionCipher(textsecure.storage.protocol, address);
|
||||
|
||||
var ourNumber = textsecure.storage.user.getNumber();
|
||||
var number = address.toString().split('.')[0];
|
||||
var options = {};
|
||||
|
||||
// No limit on message keys if we're communicating with our other devices
|
||||
if (ourNumber === number) {
|
||||
options.messageKeysLimit = false;
|
||||
}
|
||||
|
||||
var sessionCipher = new libsignal.SessionCipher(textsecure.storage.protocol, address, options);
|
||||
console.log('retrying prekey whisper message');
|
||||
return this.decryptPreKeyWhisperMessage(ciphertext, sessionCipher, address).then(function(plaintext) {
|
||||
var finalMessage = textsecure.protobuf.DataMessage.decode(plaintext);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue