Attack a type to preKeyBundleMessage.

pull/52/head
Mikunj 7 years ago
parent f29a515fdf
commit bd15f426f9

@ -43,9 +43,10 @@ function OutgoingMessage(
this.failoverNumbers = [];
this.unidentifiedDeliveries = [];
const { numberInfo, senderCertificate } = options;
const { numberInfo, senderCertificate, preKeyBundleType } = options;
this.numberInfo = numberInfo;
this.senderCertificate = senderCertificate;
this.preKeyBundleType = preKeyBundleType || textsecure.protobuf.PreKeyBundleMessage.Type.UNKOWN;
}
OutgoingMessage.prototype = {
@ -290,6 +291,12 @@ OutgoingMessage.prototype = {
if (this.attachPrekeys) {
// Encrypt them with the fallback
const preKeyBundleMessage = await libloki.getPreKeyBundleForNumber(number);
preKeyBundleMessage.type = this.preKeyBundleType;
// If we have to use fallback encryption then this must be a friend request
if (this.fallBackEncryption)
preKeyBundleMessage.type = textsecure.protobuf.PreKeyBundleMessage.Type.FRIEND_REQUEST;
const textBundle = this.convertMessageToText(preKeyBundleMessage);
const encryptedBundle = await fallBackEncryption.encrypt(textBundle);
preKeys = { preKeyBundleMessage: encryptedBundle.body };

@ -37,6 +37,13 @@ message Content {
}
message PreKeyBundleMessage {
enum Type {
UNKNOWN = 0;
FRIEND_REQUEST = 1;
FRIEND_REQUEST_ACCEPT = 2;
RESET_SESSION = 3;
RESET_SESSION_ACK = 4;
}
optional bytes identityKey = 1;
optional uint32 deviceId = 2;
optional uint32 preKeyId = 3;
@ -44,6 +51,7 @@ message PreKeyBundleMessage {
optional bytes preKey = 5;
optional bytes signedKey = 6;
optional bytes signature = 7;
optional Type type = 8;
}
message CallMessage {

Loading…
Cancel
Save