make medium group pubkey be in bytes rather than str

pull/1337/head
Audric Ackermann 5 years ago
parent 7054268b14
commit 04063cd0fb
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -42,7 +42,7 @@ message Content {
message MediumGroupCiphertext { message MediumGroupCiphertext {
optional bytes ciphertext = 1; optional bytes ciphertext = 1;
optional string source = 2; optional bytes source = 2;
optional uint32 keyIdx = 3; optional uint32 keyIdx = 3;
} }

@ -71,8 +71,8 @@ async function decryptForMediumGroup(
new Uint8Array(mediumGroupCiphertext) new Uint8Array(mediumGroupCiphertext)
); );
const ourNumber = (await UserUtil.getCurrentDevicePubKey()) as string; const ourNumber = (await UserUtil.getCurrentDevicePubKey()) as string;
const sourceAsStr = StringUtils.decode(source, 'hex');
if (source === ourNumber) { if (sourceAsStr === ourNumber) {
window.console.info( window.console.info(
'Dropping message from ourself after decryptForMediumGroup' 'Dropping message from ourself after decryptForMediumGroup'
); );
@ -83,7 +83,7 @@ async function decryptForMediumGroup(
ciphertext, ciphertext,
keyIdx, keyIdx,
groupId, groupId,
source sourceAsStr
); );
return plaintext; return plaintext;

@ -4,6 +4,7 @@ import { UserUtil } from '../../util';
import { CipherTextObject } from '../../../libtextsecure/libsignal-protocol'; import { CipherTextObject } from '../../../libtextsecure/libsignal-protocol';
import { encryptWithSenderKey } from '../../session/medium_group/ratchet'; import { encryptWithSenderKey } from '../../session/medium_group/ratchet';
import { PubKey } from '../types'; import { PubKey } from '../types';
import { StringUtils } from '../utils';
/** /**
* Add padding to a message buffer * Add padding to a message buffer
@ -90,7 +91,7 @@ export async function encryptForMediumGroup(
// We should include ciphertext idx in the message // We should include ciphertext idx in the message
const content = SignalService.MediumGroupCiphertext.encode({ const content = SignalService.MediumGroupCiphertext.encode({
ciphertext, ciphertext,
source: ourKey, source: new Uint8Array(StringUtils.encode(ourKey, 'hex')),
keyIdx, keyIdx,
}).finish(); }).finish();

Loading…
Cancel
Save