|
|
@ -39769,7 +39769,20 @@ window.textsecure.messaging = function() {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var makeAttachmentPointer;
|
|
|
|
function makeAttachmentPointer(attachment) {
|
|
|
|
|
|
|
|
var proto = new textsecure.protobuf.AttachmentPointer();
|
|
|
|
|
|
|
|
proto.key = textsecure.crypto.getRandomBytes(64);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var iv = textsecure.crypto.getRandomBytes(16);
|
|
|
|
|
|
|
|
return textsecure.crypto.encryptAttachment(attachment.data, proto.key, iv).then(function(encryptedBin) {
|
|
|
|
|
|
|
|
return TextSecureServer.putAttachment(encryptedBin).then(function(id) {
|
|
|
|
|
|
|
|
proto.id = id;
|
|
|
|
|
|
|
|
proto.contentType = attachment.contentType;
|
|
|
|
|
|
|
|
return proto;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var refreshGroup = function(number, groupId, devicesForNumber) {
|
|
|
|
var refreshGroup = function(number, groupId, devicesForNumber) {
|
|
|
|
groupId = getString(groupId);
|
|
|
|
groupId = getString(groupId);
|
|
|
|
|
|
|
|
|
|
|
@ -39951,20 +39964,6 @@ window.textsecure.messaging = function() {
|
|
|
|
getDevicesAndSendToNumber(numbers[i]);
|
|
|
|
getDevicesAndSendToNumber(numbers[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
makeAttachmentPointer = function(attachment) {
|
|
|
|
|
|
|
|
var proto = new textsecure.protobuf.AttachmentPointer();
|
|
|
|
|
|
|
|
proto.key = textsecure.crypto.getRandomBytes(64);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var iv = textsecure.crypto.getRandomBytes(16);
|
|
|
|
|
|
|
|
return textsecure.crypto.encryptAttachment(attachment.data, proto.key, iv).then(function(encryptedBin) {
|
|
|
|
|
|
|
|
return TextSecureServer.putAttachment(encryptedBin).then(function(id) {
|
|
|
|
|
|
|
|
proto.id = id;
|
|
|
|
|
|
|
|
proto.contentType = attachment.contentType;
|
|
|
|
|
|
|
|
return proto;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var sendIndividualProto = function(number, proto, timestamp) {
|
|
|
|
var sendIndividualProto = function(number, proto, timestamp) {
|
|
|
|
return new Promise(function(resolve, reject) {
|
|
|
|
return new Promise(function(resolve, reject) {
|
|
|
|
sendMessageProto(timestamp, [number], proto, function(res) {
|
|
|
|
sendMessageProto(timestamp, [number], proto, function(res) {
|
|
|
|