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
Merge branch 'dbkr/wasm' into dbkr/e2e_backups
This commit is contained in:
@@ -36,9 +36,8 @@ const DeviceList = require('./DeviceList').default;
|
||||
import OutgoingRoomKeyRequestManager from './OutgoingRoomKeyRequestManager';
|
||||
import IndexedDBCryptoStore from './store/indexeddb-crypto-store';
|
||||
|
||||
const Olm = global.Olm;
|
||||
if (!Olm) {
|
||||
throw new Error("global.Olm is not defined");
|
||||
export function isCryptoAvailable() {
|
||||
return Boolean(global.Olm);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,7 +66,7 @@ if (!Olm) {
|
||||
*
|
||||
* @param {RoomList} roomList An initialised RoomList object
|
||||
*/
|
||||
function Crypto(baseApis, sessionStore, userId, deviceId,
|
||||
export default function Crypto(baseApis, sessionStore, userId, deviceId,
|
||||
clientStore, cryptoStore, roomList) {
|
||||
this._baseApis = baseApis;
|
||||
this._sessionStore = sessionStore;
|
||||
@@ -136,6 +135,10 @@ utils.inherits(Crypto, EventEmitter);
|
||||
* Returns a promise which resolves once the crypto module is ready for use.
|
||||
*/
|
||||
Crypto.prototype.init = async function() {
|
||||
// Olm is just an object with a .then, not a fully-fledged promise, so
|
||||
// pass it into bluebird to make it a proper promise.
|
||||
await global.Olm.init();
|
||||
|
||||
const sessionStoreHasAccount = Boolean(this._sessionStore.getEndToEndAccount());
|
||||
let cryptoStoreHasAccount;
|
||||
await this._cryptoStore.doTxn(
|
||||
@@ -1721,6 +1724,3 @@ class IncomingRoomKeyRequestCancellation {
|
||||
* @event module:client~MatrixClient#"crypto.warning"
|
||||
* @param {string} type One of the strings listed above
|
||||
*/
|
||||
|
||||
/** */
|
||||
module.exports = Crypto;
|
||||
|
||||
Reference in New Issue
Block a user