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 {
optional bytes ciphertext = 1;
optional string source = 2;
optional bytes source = 2;
optional uint32 keyIdx = 3;
}

@ -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;

@ -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();

Loading…
Cancel
Save