Cleanup attachment attributes
Convert attachment ids from longs to strings, and byte buffers to arrays. // FREEBIE
This commit is contained in:
parent
6a8d0d1919
commit
a256f17e19
3 changed files with 18 additions and 10 deletions
|
@ -36748,7 +36748,7 @@ Internal.SessionLock.queueJobForNumber = function queueJobForNumber(number, runJ
|
||||||
var mac = encryptedBin.slice(encryptedBin.byteLength - 32, encryptedBin.byteLength);
|
var mac = encryptedBin.slice(encryptedBin.byteLength - 32, encryptedBin.byteLength);
|
||||||
|
|
||||||
return verifyMAC(ivAndCiphertext, mac_key, mac, 32).then(function() {
|
return verifyMAC(ivAndCiphertext, mac_key, mac, 32).then(function() {
|
||||||
if (theirDigest !== undefined) {
|
if (theirDigest !== null) {
|
||||||
return verifyDigest(encryptedBin, theirDigest);
|
return verifyDigest(encryptedBin, theirDigest);
|
||||||
}
|
}
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
|
@ -38536,12 +38536,16 @@ MessageReceiver.prototype.extend({
|
||||||
return textsecure.storage.get('blocked', []).indexOf(number) >= 0;
|
return textsecure.storage.get('blocked', []).indexOf(number) >= 0;
|
||||||
},
|
},
|
||||||
handleAttachment: function(attachment) {
|
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) {
|
function decryptAttachment(encrypted) {
|
||||||
return textsecure.crypto.decryptAttachment(
|
return textsecure.crypto.decryptAttachment(
|
||||||
encrypted,
|
encrypted,
|
||||||
attachment.key.toArrayBuffer(),
|
attachment.key,
|
||||||
digest
|
attachment.digest
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38549,7 +38553,7 @@ MessageReceiver.prototype.extend({
|
||||||
attachment.data = data;
|
attachment.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.server.getAttachment(attachment.id.toString()).
|
return this.server.getAttachment(attachment.id).
|
||||||
then(decryptAttachment).
|
then(decryptAttachment).
|
||||||
then(updateAttachment);
|
then(updateAttachment);
|
||||||
},
|
},
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
var mac = encryptedBin.slice(encryptedBin.byteLength - 32, encryptedBin.byteLength);
|
var mac = encryptedBin.slice(encryptedBin.byteLength - 32, encryptedBin.byteLength);
|
||||||
|
|
||||||
return verifyMAC(ivAndCiphertext, mac_key, mac, 32).then(function() {
|
return verifyMAC(ivAndCiphertext, mac_key, mac, 32).then(function() {
|
||||||
if (theirDigest !== undefined) {
|
if (theirDigest !== null) {
|
||||||
return verifyDigest(encryptedBin, theirDigest);
|
return verifyDigest(encryptedBin, theirDigest);
|
||||||
}
|
}
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
|
|
|
@ -342,12 +342,16 @@ MessageReceiver.prototype.extend({
|
||||||
return textsecure.storage.get('blocked', []).indexOf(number) >= 0;
|
return textsecure.storage.get('blocked', []).indexOf(number) >= 0;
|
||||||
},
|
},
|
||||||
handleAttachment: function(attachment) {
|
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) {
|
function decryptAttachment(encrypted) {
|
||||||
return textsecure.crypto.decryptAttachment(
|
return textsecure.crypto.decryptAttachment(
|
||||||
encrypted,
|
encrypted,
|
||||||
attachment.key.toArrayBuffer(),
|
attachment.key,
|
||||||
digest
|
attachment.digest
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,7 +359,7 @@ MessageReceiver.prototype.extend({
|
||||||
attachment.data = data;
|
attachment.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.server.getAttachment(attachment.id.toString()).
|
return this.server.getAttachment(attachment.id).
|
||||||
then(decryptAttachment).
|
then(decryptAttachment).
|
||||||
then(updateAttachment);
|
then(updateAttachment);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue