Add attachment digests

// FREEBIE
This commit is contained in:
lilia 2017-03-07 16:54:15 -08:00
parent f1a1a819ba
commit 43de0cc2ec
5 changed files with 65 additions and 10 deletions

View file

@ -119,10 +119,11 @@ MessageSender.prototype = {
proto.key = libsignal.crypto.getRandomBytes(64);
var iv = libsignal.crypto.getRandomBytes(16);
return textsecure.crypto.encryptAttachment(attachment.data, proto.key, iv).then(function(encryptedBin) {
return this.server.putAttachment(encryptedBin).then(function(id) {
return textsecure.crypto.encryptAttachment(attachment.data, proto.key, iv).then(function(result) {
return this.server.putAttachment(result.ciphertext).then(function(id) {
proto.id = id;
proto.contentType = attachment.contentType;
proto.digest = result.digest;
return proto;
});
}.bind(this));