diff --git a/protos/SignalService.proto b/protos/SignalService.proto index 54391519f..f7b76be2f 100644 --- a/protos/SignalService.proto +++ b/protos/SignalService.proto @@ -42,7 +42,7 @@ message Content { message MediumGroupCiphertext { optional bytes ciphertext = 1; - optional string source = 2; + optional bytes source = 2; optional uint32 keyIdx = 3; } diff --git a/ts/receiver/contentMessage.ts b/ts/receiver/contentMessage.ts index 4425a528c..7c125267c 100644 --- a/ts/receiver/contentMessage.ts +++ b/ts/receiver/contentMessage.ts @@ -71,8 +71,8 @@ async function decryptForMediumGroup( new Uint8Array(mediumGroupCiphertext) ); const ourNumber = (await UserUtil.getCurrentDevicePubKey()) as string; - - if (source === ourNumber) { + const sourceAsStr = StringUtils.decode(source, 'hex'); + if (sourceAsStr === ourNumber) { window.console.info( 'Dropping message from ourself after decryptForMediumGroup' ); @@ -83,7 +83,7 @@ async function decryptForMediumGroup( ciphertext, keyIdx, groupId, - source + sourceAsStr ); return plaintext; diff --git a/ts/session/crypto/MessageEncrypter.ts b/ts/session/crypto/MessageEncrypter.ts index ba97ca7a2..3380cb205 100644 --- a/ts/session/crypto/MessageEncrypter.ts +++ b/ts/session/crypto/MessageEncrypter.ts @@ -4,6 +4,7 @@ import { UserUtil } from '../../util'; import { CipherTextObject } from '../../../libtextsecure/libsignal-protocol'; import { encryptWithSenderKey } from '../../session/medium_group/ratchet'; import { PubKey } from '../types'; +import { StringUtils } from '../utils'; /** * Add padding to a message buffer @@ -90,7 +91,7 @@ export async function encryptForMediumGroup( // We should include ciphertext idx in the message const content = SignalService.MediumGroupCiphertext.encode({ ciphertext, - source: ourKey, + source: new Uint8Array(StringUtils.encode(ourKey, 'hex')), keyIdx, }).finish();