Update libsignal-protocol v1.1.4

// FREEBIE
pull/749/head
lilia 9 years ago
parent 9ab64ec44d
commit d11f9fd538

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

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

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

Loading…
Cancel
Save