diff --git a/lib/crypto/algorithms/olm.js b/lib/crypto/algorithms/olm.js index de0892e06..672308d24 100644 --- a/lib/crypto/algorithms/olm.js +++ b/lib/crypto/algorithms/olm.js @@ -119,17 +119,6 @@ OlmEncryption.prototype.encryptMessage = function(room, eventType, content) { room_id: room.roomId, type: eventType, content: content, - // Include the ED25519 key so that the recipient knows what - // device this message came from. - // We don't need to include the curve25519 key since the - // recipient will already know this from the olm headers. - // When combined with the device keys retrieved from the - // homeserver signed by the ed25519 key this proves that - // the curve25519 key and the ed25519 key are owned by - // the same device. - keys: { - "ed25519": self._olmDevice.deviceEd25519Key - }, } ); }); diff --git a/lib/crypto/olmlib.js b/lib/crypto/olmlib.js index a7114b960..a6db51f64 100644 --- a/lib/crypto/olmlib.js +++ b/lib/crypto/olmlib.js @@ -51,6 +51,18 @@ module.exports.encryptMessageForDevices = function( var payloadJson = { fingerprint: participantHash, sender_device: ourDeviceId, + + // Include the Ed25519 key so that the recipient knows what + // device this message came from. + // We don't need to include the curve25519 key since the + // recipient will already know this from the olm headers. + // When combined with the device keys retrieved from the + // homeserver signed by the ed25519 key this proves that + // the curve25519 key and the ed25519 key are owned by + // the same device. + keys: { + "ed25519": olmDevice.deviceEd25519Key, + }, }; utils.extend(payloadJson, payloadFields);