You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
some linting
This commit is contained in:
@@ -35,7 +35,6 @@ import {StubStore} from "./store/stub";
|
||||
import {createNewMatrixCall} from "./webrtc/call";
|
||||
import {CallEventHandler} from './webrtc/callEventHandler';
|
||||
import * as utils from './utils';
|
||||
import {sleep} from './utils';
|
||||
import {
|
||||
MatrixError,
|
||||
PREFIX_MEDIA_R0,
|
||||
@@ -64,29 +63,6 @@ export const CRYPTO_ENABLED = isCryptoAvailable();
|
||||
const CAPABILITIES_CACHE_MS = 21600000; // 6 hours - an arbitrary value
|
||||
const TURN_CHECK_INTERVAL = 10 * 60 * 1000; // poll for turn credentials every 10 minutes
|
||||
|
||||
function keysFromRecoverySession(sessions, decryptionKey, roomId) {
|
||||
const keys = [];
|
||||
for (const [sessionId, sessionData] of Object.entries(sessions)) {
|
||||
try {
|
||||
const decrypted = keyFromRecoverySession(sessionData, decryptionKey);
|
||||
decrypted.session_id = sessionId;
|
||||
decrypted.room_id = roomId;
|
||||
keys.push(decrypted);
|
||||
} catch (e) {
|
||||
logger.log("Failed to decrypt megolm session from backup", e);
|
||||
}
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
|
||||
function keyFromRecoverySession(session, decryptionKey) {
|
||||
return JSON.parse(decryptionKey.decrypt(
|
||||
session.session_data.ephemeral,
|
||||
session.session_data.mac,
|
||||
session.session_data.ciphertext,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a Matrix Client. Only directly construct this if you want to use
|
||||
* custom modules. Normally, {@link createClient} should be used
|
||||
@@ -1843,13 +1819,15 @@ MatrixClient.prototype.getKeyBackupEnabled = function() {
|
||||
* getKeyBackupVersion.
|
||||
*
|
||||
* @param {object} info Backup information object as returned by getKeyBackupVersion
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
MatrixClient.prototype.enableKeyBackup = function(info) {
|
||||
MatrixClient.prototype.enableKeyBackup = async function(info) {
|
||||
if (this._crypto === null) {
|
||||
throw new Error("End-to-end encryption disabled");
|
||||
}
|
||||
|
||||
return this._crypto.backupManager.enableKeyBackup();
|
||||
await this._crypto.backupManager.enableKeyBackup();
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -174,7 +174,7 @@ export function Crypto(baseApis, sessionStore, userId, deviceId,
|
||||
await this.storeSecret("m.megolm_backup.v1", fixedKey, [keyId]);
|
||||
}
|
||||
|
||||
return decodeBase64(fixedKey || storedKey);
|
||||
return olmlib.decodeBase64(fixedKey || storedKey);
|
||||
}
|
||||
|
||||
// try to get key from app
|
||||
|
||||
Reference in New Issue
Block a user