Update libaxolotl

// FREEBIE
This commit is contained in:
lilia 2015-10-28 16:33:54 -07:00
parent cbc82a95f7
commit a644b7a674
2 changed files with 24 additions and 2 deletions

View file

@ -37496,6 +37496,17 @@ window.axolotl.protocol = function(storage_interface) {
return result;
});
});
};
function getPaddedMessageLength(messageLength) {
var messageLengthWithTerminator = messageLength + 1;
var messagePartCount = messageLengthWithTerminator / 160;
if (messageLengthWithTerminator % 160 != 0) {
messagePartCount++;
}
return messagePartCount * 160;
}
// return Promise(encoded [PreKey]WhisperMessage)
@ -37509,7 +37520,7 @@ window.axolotl.protocol = function(storage_interface) {
var msg = new axolotlInternal.protobuf.WhisperMessage();
var plaintext = axolotlInternal.utils.convertToArrayBuffer(pushMessageContent.encode());
var paddedPlaintext = new Uint8Array(Math.ceil((plaintext.byteLength + 1) / 160.0) * 160 - 1);
var paddedPlaintext = new Uint8Array(getPaddedMessageLength(plaintext.byteLength));
paddedPlaintext.set(new Uint8Array(plaintext));
paddedPlaintext[plaintext.byteLength] = 0x80;

View file

@ -37398,6 +37398,17 @@ window.axolotl.protocol = function(storage_interface) {
return result;
});
});
};
function getPaddedMessageLength(messageLength) {
var messageLengthWithTerminator = messageLength + 1;
var messagePartCount = messageLengthWithTerminator / 160;
if (messageLengthWithTerminator % 160 != 0) {
messagePartCount++;
}
return messagePartCount * 160;
}
// return Promise(encoded [PreKey]WhisperMessage)
@ -37411,7 +37422,7 @@ window.axolotl.protocol = function(storage_interface) {
var msg = new axolotlInternal.protobuf.WhisperMessage();
var plaintext = axolotlInternal.utils.convertToArrayBuffer(pushMessageContent.encode());
var paddedPlaintext = new Uint8Array(Math.ceil((plaintext.byteLength + 1) / 160.0) * 160 - 1);
var paddedPlaintext = new Uint8Array(getPaddedMessageLength(plaintext.byteLength));
paddedPlaintext.set(new Uint8Array(plaintext));
paddedPlaintext[plaintext.byteLength] = 0x80;