Move makeAttachmentPointer
Clean up unnecessary pre-declaration of `var makeAttachmentPointer`.
This commit is contained in:
parent
67f25214d3
commit
c05be725b3
2 changed files with 28 additions and 30 deletions
|
@ -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) {
|
||||
groupId = getString(groupId);
|
||||
|
||||
|
@ -39951,20 +39964,6 @@ window.textsecure.messaging = function() {
|
|||
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) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
sendMessageProto(timestamp, [number], proto, function(res) {
|
||||
|
|
|
@ -65,7 +65,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) {
|
||||
groupId = getString(groupId);
|
||||
|
||||
|
@ -247,20 +260,6 @@ window.textsecure.messaging = function() {
|
|||
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) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
sendMessageProto(timestamp, [number], proto, function(res) {
|
||||
|
|
Loading…
Reference in a new issue