Update libsignal-protocol v1.1.4

// FREEBIE
This commit is contained in:
lilia 2016-08-11 18:13:26 -07:00
parent 9ab64ec44d
commit d11f9fd538
3 changed files with 34 additions and 22 deletions

View file

@ -36248,9 +36248,18 @@ SessionCipher.prototype = {
preKeyMsg.message = message;
var result = String.fromCharCode((3 << 4) | 3) + util.toString(preKeyMsg.encode());
return {type: 3, body: result};
return {
type : 3,
body : result,
registrationId : record.registrationId
};
} else {
return {type: 1, body: util.toString(message)};
return {
type : 1,
body : util.toString(message),
registrationId : record.registrationId
};
}
});
}.bind(this));
@ -38581,19 +38590,16 @@ OutgoingMessage.prototype = {
},
encryptToDevice: function(address, plaintext, sessionCipher) {
return Promise.all([
sessionCipher.encrypt(plaintext),
sessionCipher.getRemoteRegistrationId()
]).then(function(result) {
return this.toJSON(address, result[0], result[1]);
return sessionCipher.encrypt(plaintext).then(function(ciphertext) {
return this.toJSON(address, ciphertext);
}.bind(this));
},
toJSON: function(address, encryptedMsg, registrationId) {
toJSON: function(address, encryptedMsg) {
var json = {
type: encryptedMsg.type,
destinationDeviceId: address.getDeviceId(),
destinationRegistrationId: registrationId
type : encryptedMsg.type,
destinationDeviceId : address.getDeviceId(),
destinationRegistrationId : encryptedMsg.registrationId
};
var content = btoa(encryptedMsg.body);

View file

@ -36124,9 +36124,18 @@ SessionCipher.prototype = {
preKeyMsg.message = message;
var result = String.fromCharCode((3 << 4) | 3) + util.toString(preKeyMsg.encode());
return {type: 3, body: result};
return {
type : 3,
body : result,
registrationId : record.registrationId
};
} else {
return {type: 1, body: util.toString(message)};
return {
type : 1,
body : util.toString(message),
registrationId : record.registrationId
};
}
});
}.bind(this));

View file

@ -157,19 +157,16 @@ OutgoingMessage.prototype = {
},
encryptToDevice: function(address, plaintext, sessionCipher) {
return Promise.all([
sessionCipher.encrypt(plaintext),
sessionCipher.getRemoteRegistrationId()
]).then(function(result) {
return this.toJSON(address, result[0], result[1]);
return sessionCipher.encrypt(plaintext).then(function(ciphertext) {
return this.toJSON(address, ciphertext);
}.bind(this));
},
toJSON: function(address, encryptedMsg, registrationId) {
toJSON: function(address, encryptedMsg) {
var json = {
type: encryptedMsg.type,
destinationDeviceId: address.getDeviceId(),
destinationRegistrationId: registrationId
type : encryptedMsg.type,
destinationDeviceId : address.getDeviceId(),
destinationRegistrationId : encryptedMsg.registrationId
};
var content = btoa(encryptedMsg.body);