You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-12-01 04:43:29 +03:00
Address review comments
Avoid gut-wrenching properties on IncomingRoomKeyRequest.
This commit is contained in:
@@ -1138,7 +1138,7 @@ Crypto.prototype._processReceivedRoomKeyRequests = function() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
req._shareCallback = () => {
|
req.share = () => {
|
||||||
decryptor.shareKeysWithDevice(req);
|
decryptor.shareKeysWithDevice(req);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1244,6 +1244,9 @@ Crypto.prototype._signObject = function(obj) {
|
|||||||
* @property {string} deviceId device requesting the key
|
* @property {string} deviceId device requesting the key
|
||||||
* @property {string} requestId unique id for the request
|
* @property {string} requestId unique id for the request
|
||||||
* @property {RoomKeyRequestBody} requestBody
|
* @property {RoomKeyRequestBody} requestBody
|
||||||
|
* @property {Function} share callback which, when called, will ask
|
||||||
|
* the relevant crypto algorithm implementation to share the keys for
|
||||||
|
* this request.
|
||||||
*/
|
*/
|
||||||
class IncomingRoomKeyRequest {
|
class IncomingRoomKeyRequest {
|
||||||
constructor(event) {
|
constructor(event) {
|
||||||
@@ -1253,19 +1256,9 @@ class IncomingRoomKeyRequest {
|
|||||||
this.deviceId = content.requesting_device_id;
|
this.deviceId = content.requesting_device_id;
|
||||||
this.requestId = content.request_id;
|
this.requestId = content.request_id;
|
||||||
this.requestBody = content.body || {};
|
this.requestBody = content.body || {};
|
||||||
this._shareCallback = null;
|
this.share = () => {
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ask the relevant crypto algorithm implementation to share the keys for
|
|
||||||
* this request
|
|
||||||
*/
|
|
||||||
share() {
|
|
||||||
if (this._shareCallback) {
|
|
||||||
this._shareCallback();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
throw new Error("don't know how to share keys for this request yet");
|
throw new Error("don't know how to share keys for this request yet");
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user