mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-26 03:18:17 +01:00
Cleanup attachment attributes
Convert attachment ids from longs to strings, and byte buffers to arrays. // FREEBIE
This commit is contained in:
@@ -342,12 +342,16 @@ MessageReceiver.prototype.extend({
|
||||
return textsecure.storage.get('blocked', []).indexOf(number) >= 0;
|
||||
},
|
||||
handleAttachment: function(attachment) {
|
||||
var digest = attachment.digest ? attachment.digest.toArrayBuffer() : undefined;
|
||||
attachment.id = attachment.id.toString();
|
||||
attachment.key = attachment.key.toArrayBuffer();
|
||||
if (attachment.digest) {
|
||||
attachment.digest = attachment.digest.toArrayBuffer();
|
||||
}
|
||||
function decryptAttachment(encrypted) {
|
||||
return textsecure.crypto.decryptAttachment(
|
||||
encrypted,
|
||||
attachment.key.toArrayBuffer(),
|
||||
digest
|
||||
attachment.key,
|
||||
attachment.digest
|
||||
);
|
||||
}
|
||||
|
||||
@@ -355,7 +359,7 @@ MessageReceiver.prototype.extend({
|
||||
attachment.data = data;
|
||||
}
|
||||
|
||||
return this.server.getAttachment(attachment.id.toString()).
|
||||
return this.server.getAttachment(attachment.id).
|
||||
then(decryptAttachment).
|
||||
then(updateAttachment);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user