Re-create some of d9bf0a4
, which was broken and reverted in 1e6720
This commit is contained in:
parent
18f1eed70f
commit
21b95ce1d3
2 changed files with 3 additions and 5 deletions
|
@ -603,9 +603,7 @@ window.textsecure.crypto = new function() {
|
||||||
case 0: //TYPE_MESSAGE_PLAINTEXT
|
case 0: //TYPE_MESSAGE_PLAINTEXT
|
||||||
return Promise.resolve(textsecure.protos.decodePushMessageContentProtobuf(getString(proto.message)));
|
return Promise.resolve(textsecure.protos.decodePushMessageContentProtobuf(getString(proto.message)));
|
||||||
case 1: //TYPE_MESSAGE_CIPHERTEXT
|
case 1: //TYPE_MESSAGE_CIPHERTEXT
|
||||||
return decryptWhisperMessage(proto.source + "." + proto.sourceDevice, getString(proto.message)).then(function(result) {
|
return decryptWhisperMessage(proto.source + "." + proto.sourceDevice, getString(proto.message));
|
||||||
return {message:result, pushMessage: proto};
|
|
||||||
});
|
|
||||||
case 3: //TYPE_MESSAGE_PREKEY_BUNDLE
|
case 3: //TYPE_MESSAGE_PREKEY_BUNDLE
|
||||||
if (proto.message.readUint8() != (2 << 4 | 2))
|
if (proto.message.readUint8() != (2 << 4 | 2))
|
||||||
throw new Error("Bad version byte");
|
throw new Error("Bad version byte");
|
||||||
|
@ -615,7 +613,7 @@ window.textsecure.crypto = new function() {
|
||||||
return decryptWhisperMessage(proto.source, getString(preKeyProto.message), sessions[0]).then(function(result) {
|
return decryptWhisperMessage(proto.source, getString(preKeyProto.message), sessions[0]).then(function(result) {
|
||||||
if (sessions[1] !== undefined)
|
if (sessions[1] !== undefined)
|
||||||
crypto_storage.saveSession(proto.source, sessions[1]);
|
crypto_storage.saveSession(proto.source, sessions[1]);
|
||||||
return {message: result, pushMessage:proto};
|
return result;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -495,7 +495,7 @@ window.textsecure.subscribeToPush = function() {
|
||||||
for (var i = 0; i < decrypted.message.attachments.length; i++)
|
for (var i = 0; i < decrypted.message.attachments.length; i++)
|
||||||
promises[i] = handleAttachment(decrypted.message.attachments[i]);
|
promises[i] = handleAttachment(decrypted.message.attachments[i]);
|
||||||
return Promise.all(promises).then(function() {
|
return Promise.all(promises).then(function() {
|
||||||
message_callback(decrypted);
|
message_callback({pushMessage: proto, message: decrypted});
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
}).catch(function(e) {
|
}).catch(function(e) {
|
||||||
|
|
Loading…
Reference in a new issue