You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-25 05:23:13 +03:00
Convert src to ES6
The bulk of this is just export/import changes, though there's a couple pieces to highlight: * We no longer use default exports. This is because it's discouraged by the JS community, though not in any official capacity. * We now use `polyfillSuper` for some prototype inheritance because the tests, and sometimes webpack, break on "cannot call EncryptionAlgorithm without 'new'". It's very much a workaround, and definitely not needed when we use real classes. There is some import shuffling to help keep the imports clean - this was done by my IDE.
This commit is contained in:
@@ -22,38 +22,30 @@ limitations under the License.
|
||||
* @module crypto
|
||||
*/
|
||||
|
||||
const anotherjson = require('another-json');
|
||||
import anotherjson from "another-json";
|
||||
import {EventEmitter} from 'events';
|
||||
import ReEmitter from '../ReEmitter';
|
||||
import {ReEmitter} from '../ReEmitter';
|
||||
import {logger} from '../logger';
|
||||
import * as utils from "../utils";
|
||||
import {sleep} from "../utils";
|
||||
import {OlmDevice} from "./OlmDevice";
|
||||
import * as olmlib from "./olmlib";
|
||||
import {DeviceList} from "./DeviceList";
|
||||
import {DeviceInfo} from "./deviceinfo";
|
||||
import * as algorithms from "./algorithms";
|
||||
import {CrossSigningInfo, CrossSigningLevel, DeviceTrustLevel, UserTrustLevel} from './CrossSigning';
|
||||
import {SECRET_STORAGE_ALGORITHM_V1, SecretStorage} from './SecretStorage';
|
||||
import {OutgoingRoomKeyRequestManager} from './OutgoingRoomKeyRequestManager';
|
||||
import {IndexedDBCryptoStore} from './store/indexeddb-crypto-store';
|
||||
import {ScanQRCode, ShowQRCode} from './verification/QRCode';
|
||||
import {SAS} from './verification/SAS';
|
||||
import {keyFromPassphrase} from './key_passphrase';
|
||||
import {encodeRecoveryKey} from './recoverykey';
|
||||
import {VerificationRequest} from "./verification/request/VerificationRequest";
|
||||
import {InRoomChannel} from "./verification/request/InRoomChannel";
|
||||
import {ToDeviceChannel} from "./verification/request/ToDeviceChannel";
|
||||
|
||||
import logger from '../logger';
|
||||
const utils = require("../utils");
|
||||
const OlmDevice = require("./OlmDevice");
|
||||
const olmlib = require("./olmlib");
|
||||
const algorithms = require("./algorithms");
|
||||
const DeviceInfo = require("./deviceinfo");
|
||||
const DeviceVerification = DeviceInfo.DeviceVerification;
|
||||
const DeviceList = require('./DeviceList').default;
|
||||
import {
|
||||
CrossSigningInfo,
|
||||
UserTrustLevel,
|
||||
DeviceTrustLevel,
|
||||
CrossSigningLevel,
|
||||
} from './CrossSigning';
|
||||
import SecretStorage, { SECRET_STORAGE_ALGORITHM_V1 } from './SecretStorage';
|
||||
|
||||
import OutgoingRoomKeyRequestManager from './OutgoingRoomKeyRequestManager';
|
||||
import IndexedDBCryptoStore from './store/indexeddb-crypto-store';
|
||||
|
||||
import {ShowQRCode, ScanQRCode} from './verification/QRCode';
|
||||
import SAS from './verification/SAS';
|
||||
import {sleep} from '../utils';
|
||||
import { keyFromPassphrase } from './key_passphrase';
|
||||
import { encodeRecoveryKey } from './recoverykey';
|
||||
|
||||
import VerificationRequest from "./verification/request/VerificationRequest";
|
||||
import InRoomChannel from "./verification/request/InRoomChannel";
|
||||
import ToDeviceChannel from "./verification/request/ToDeviceChannel";
|
||||
|
||||
const defaultVerificationMethods = {
|
||||
[ScanQRCode.NAME]: ScanQRCode,
|
||||
@@ -107,7 +99,7 @@ const KEY_BACKUP_KEYS_PER_REQUEST = 200;
|
||||
* Each element can either be a string from MatrixClient.verificationMethods
|
||||
* or a class that implements a verification method.
|
||||
*/
|
||||
export default function Crypto(baseApis, sessionStore, userId, deviceId,
|
||||
export function Crypto(baseApis, sessionStore, userId, deviceId,
|
||||
clientStore, cryptoStore, roomList, verificationMethods) {
|
||||
this._onDeviceListUserCrossSigningUpdated =
|
||||
this._onDeviceListUserCrossSigningUpdated.bind(this);
|
||||
|
||||
Reference in New Issue
Block a user