You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-29 16:43:09 +03:00
Include keysProved and keysClaimed in the local echo for events we send.
This commit is contained in:
@@ -797,10 +797,15 @@ Crypto.prototype.encryptEventIfNeeded = function(event, room) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var myKeys = {
|
||||||
|
curve25519: this._olmDevice.deviceCurve25519Key,
|
||||||
|
ed25519: this._olmDevice.deviceEd25519Key,
|
||||||
|
};
|
||||||
|
|
||||||
return alg.encryptMessage(
|
return alg.encryptMessage(
|
||||||
room, event.getType(), event.getContent()
|
room, event.getType(), event.getContent()
|
||||||
).then(function(encryptedContent) {
|
).then(function(encryptedContent) {
|
||||||
event.makeEncrypted("m.room.encrypted", encryptedContent);
|
event.makeEncrypted("m.room.encrypted", encryptedContent, myKeys);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -214,12 +214,15 @@ module.exports.MatrixEvent.prototype = {
|
|||||||
* <tt>"m.room.encrypted"</tt>
|
* <tt>"m.room.encrypted"</tt>
|
||||||
*
|
*
|
||||||
* @param {object} crypto_content raw 'content' for the encrypted event.
|
* @param {object} crypto_content raw 'content' for the encrypted event.
|
||||||
|
* @param {object} keys The local keys claimed and proved by this event.
|
||||||
*/
|
*/
|
||||||
makeEncrypted: function(crypto_type, crypto_content) {
|
makeEncrypted: function(crypto_type, crypto_content, keys) {
|
||||||
// keep the plain-text data for 'view source'
|
// keep the plain-text data for 'view source'
|
||||||
this._clearEvent = {
|
this._clearEvent = {
|
||||||
type: this.event.type,
|
type: this.event.type,
|
||||||
content: this.event.content,
|
content: this.event.content,
|
||||||
|
keysProved: keys,
|
||||||
|
keysClaimed: keys,
|
||||||
};
|
};
|
||||||
this.event.type = crypto_type;
|
this.event.type = crypto_type;
|
||||||
this.event.content = crypto_content;
|
this.event.content = crypto_content;
|
||||||
@@ -243,6 +246,10 @@ module.exports.MatrixEvent.prototype = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The keys that must have been owned by the sender of this encrypted event.
|
* The keys that must have been owned by the sender of this encrypted event.
|
||||||
|
* These don't necessarily have to come from this event itself, but may be
|
||||||
|
* implied by the cryptographic session.
|
||||||
|
* For example megolm messages don't claim keys directly, but instead
|
||||||
|
* inherit a claim from the olm message that established the session.
|
||||||
* @return {object}
|
* @return {object}
|
||||||
*/
|
*/
|
||||||
getKeysProved: function() {
|
getKeysProved: function() {
|
||||||
@@ -251,6 +258,10 @@ module.exports.MatrixEvent.prototype = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The additional keys the sender of this encrypted event claims to possess
|
* The additional keys the sender of this encrypted event claims to possess
|
||||||
|
* These don't necessarily have to come from this event itself, but may be
|
||||||
|
* implied by the cryptographic session.
|
||||||
|
* For example megolm messages don't claim keys directly, but instead
|
||||||
|
* inherit a claim from the olm message that established the session.
|
||||||
* @return {object}
|
* @return {object}
|
||||||
*/
|
*/
|
||||||
getKeysClaimed: function() {
|
getKeysClaimed: function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user