Medium group messages show correct sender

pull/1134/head
Maxim Shishmarev 6 years ago
parent 53f26d588a
commit 3a1f071177

@ -682,7 +682,7 @@ MessageReceiver.prototype.extend({
const { senderIdentity } = envelope; const { senderIdentity } = envelope;
const { const {
ciphertext: ciphertext2, ciphertext: outerCiphertext,
ephemeralKey, ephemeralKey,
} = textsecure.protobuf.MediumGroupContent.decode(ciphertextObj); } = textsecure.protobuf.MediumGroupContent.decode(ciphertextObj);
@ -692,16 +692,16 @@ MessageReceiver.prototype.extend({
'hex' 'hex'
).toArrayBuffer(); ).toArrayBuffer();
const res = await libloki.crypto.decryptForPubkey( const mediumGroupCiphertext = await libloki.crypto.decryptForPubkey(
secretKey, secretKey,
ephemKey, ephemKey,
ciphertext2.toArrayBuffer() outerCiphertext.toArrayBuffer()
); );
const { const {
ciphertext, ciphertext,
keyIdx, keyIdx,
} = textsecure.protobuf.MediumGroupCiphertext.decode(res); } = textsecure.protobuf.MediumGroupCiphertext.decode(mediumGroupCiphertext);
const plaintext = await window.SenderKeyAPI.decryptWithSenderKey( const plaintext = await window.SenderKeyAPI.decryptWithSenderKey(
ciphertext.toArrayBuffer(), ciphertext.toArrayBuffer(),
@ -1310,10 +1310,19 @@ MessageReceiver.prototype.extend({
// Build a 'message' event i.e. a received message event // Build a 'message' event i.e. a received message event
const ev = new Event('message'); const ev = new Event('message');
const source = envelope.senderIdentity || senderPubKey;
if (envelope.senderIdentity) {
message.group = {
id: envelope.source
};
}
ev.confirm = this.removeFromCache.bind(this, envelope); ev.confirm = this.removeFromCache.bind(this, envelope);
ev.data = { ev.data = {
friendRequest: isFriendRequest, friendRequest: isFriendRequest,
source: senderPubKey, source,
sourceDevice: envelope.sourceDevice, sourceDevice: envelope.sourceDevice,
timestamp: envelope.timestamp.toNumber(), timestamp: envelope.timestamp.toNumber(),
receivedAt: envelope.receivedAt, receivedAt: envelope.receivedAt,

Loading…
Cancel
Save