You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-28 05:03:59 +03:00
Merge branch 'develop' into backup_refactor
This commit is contained in:
@@ -22,9 +22,9 @@ limitations under the License.
|
||||
* @module crypto/algorithms/megolm
|
||||
*/
|
||||
|
||||
import {logger} from '../../logger';
|
||||
import { logger } from '../../logger';
|
||||
import * as utils from "../../utils";
|
||||
import {polyfillSuper} from "../../utils";
|
||||
import { polyfillSuper } from "../../utils";
|
||||
import * as olmlib from "../olmlib";
|
||||
import {
|
||||
DecryptionAlgorithm,
|
||||
@@ -34,7 +34,7 @@ import {
|
||||
UnknownDeviceError,
|
||||
} from "./base";
|
||||
|
||||
import {WITHHELD_MESSAGES} from '../OlmDevice';
|
||||
import { WITHHELD_MESSAGES } from '../OlmDevice';
|
||||
|
||||
// determine whether the key can be shared with invitees
|
||||
function isRoomSharedHistory(room) {
|
||||
@@ -75,7 +75,6 @@ function OutboundSessionInfo(sessionId, sharedHistory = false) {
|
||||
this.sharedHistory = sharedHistory;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if it's time to rotate the session
|
||||
*
|
||||
@@ -158,7 +157,6 @@ OutboundSessionInfo.prototype.sharedWithTooManyDevices = function(
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Megolm encryption implementation
|
||||
*
|
||||
@@ -328,7 +326,7 @@ MegolmEncryption.prototype._ensureOutboundSession = async function(
|
||||
failedServerMap.add(server);
|
||||
}
|
||||
const failedDevices = [];
|
||||
for (const {userId, deviceInfo} of errorDevices) {
|
||||
for (const { userId, deviceInfo } of errorDevices) {
|
||||
const userHS = userId.slice(userId.indexOf(":") + 1);
|
||||
if (failedServerMap.has(userHS)) {
|
||||
retryDevices[userId] = retryDevices[userId] || [];
|
||||
@@ -336,7 +334,7 @@ MegolmEncryption.prototype._ensureOutboundSession = async function(
|
||||
} else {
|
||||
// if we aren't going to retry, then handle it
|
||||
// as a failed device
|
||||
failedDevices.push({userId, deviceInfo});
|
||||
failedDevices.push({ userId, deviceInfo });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,8 +408,8 @@ MegolmEncryption.prototype._prepareNewSession = async function(sharedHistory) {
|
||||
|
||||
await this._olmDevice.addInboundGroupSession(
|
||||
this._roomId, this._olmDevice.deviceCurve25519Key, [], sessionId,
|
||||
key.key, {ed25519: this._olmDevice.deviceEd25519Key}, false,
|
||||
{sharedHistory: sharedHistory},
|
||||
key.key, { ed25519: this._olmDevice.deviceEd25519Key }, false,
|
||||
{ sharedHistory: sharedHistory },
|
||||
);
|
||||
|
||||
// don't wait for it to complete
|
||||
@@ -453,7 +451,7 @@ MegolmEncryption.prototype._getDevicesWithoutSessions = function(
|
||||
// no session with this device, probably because there
|
||||
// were no one-time keys.
|
||||
|
||||
noOlmDevices.push({userId, deviceInfo});
|
||||
noOlmDevices.push({ userId, deviceInfo });
|
||||
delete sessionResults[deviceId];
|
||||
|
||||
// ensureOlmSessionsForUsers has already done the logging,
|
||||
@@ -818,7 +816,7 @@ MegolmEncryption.prototype._notifyFailedOlmDevices = async function(
|
||||
|
||||
// mark the devices that failed as "handled" because we don't want to try
|
||||
// to claim a one-time-key for dead devices on every message.
|
||||
for (const {userId, deviceInfo} of failedDevices) {
|
||||
for (const { userId, deviceInfo } of failedDevices) {
|
||||
const deviceId = deviceInfo.deviceId;
|
||||
|
||||
session.markSharedWithDevice(
|
||||
@@ -835,7 +833,7 @@ MegolmEncryption.prototype._notifyFailedOlmDevices = async function(
|
||||
`in ${this._roomId}`,
|
||||
);
|
||||
const blockedMap = {};
|
||||
for (const {userId, deviceInfo} of filteredFailedDevices) {
|
||||
for (const { userId, deviceInfo } of filteredFailedDevices) {
|
||||
blockedMap[userId] = blockedMap[userId] || {};
|
||||
// we use a similar format to what
|
||||
// olmlib.ensureOlmSessionsForDevices returns, so that
|
||||
@@ -1340,7 +1338,6 @@ MegolmDecryption.prototype._removeEventFromPendingList = function(event) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*
|
||||
@@ -1484,7 +1481,7 @@ MegolmDecryption.prototype.onRoomKeyWithheldEvent = async function(event) {
|
||||
}
|
||||
}
|
||||
await olmlib.ensureOlmSessionsForDevices(
|
||||
this._olmDevice, this._baseApis, {[sender]: [device]}, false,
|
||||
this._olmDevice, this._baseApis, { [sender]: [device] }, false,
|
||||
);
|
||||
const encryptedContent = {
|
||||
algorithm: olmlib.OLM_ALGORITHM,
|
||||
@@ -1498,7 +1495,7 @@ MegolmDecryption.prototype.onRoomKeyWithheldEvent = async function(event) {
|
||||
this._olmDevice,
|
||||
sender,
|
||||
device,
|
||||
{type: "m.dummy"},
|
||||
{ type: "m.dummy" },
|
||||
);
|
||||
|
||||
await this._olmDevice.recordSessionProblem(senderKey, "no_olm", true);
|
||||
|
||||
@@ -20,11 +20,11 @@ limitations under the License.
|
||||
* @module crypto/algorithms/olm
|
||||
*/
|
||||
|
||||
import {logger} from '../../logger';
|
||||
import { logger } from '../../logger';
|
||||
import * as utils from "../../utils";
|
||||
import {polyfillSuper} from "../../utils";
|
||||
import { polyfillSuper } from "../../utils";
|
||||
import * as olmlib from "../olmlib";
|
||||
import {DeviceInfo} from "../deviceinfo";
|
||||
import { DeviceInfo } from "../deviceinfo";
|
||||
import {
|
||||
DecryptionAlgorithm,
|
||||
DecryptionError,
|
||||
@@ -358,5 +358,4 @@ OlmDecryption.prototype._reallyDecryptMessage = async function(
|
||||
return res.payload;
|
||||
};
|
||||
|
||||
|
||||
registerAlgorithm(olmlib.OLM_ALGORITHM, OlmEncryption, OlmDecryption);
|
||||
|
||||
Reference in New Issue
Block a user