diff --git a/src/client.ts b/src/client.ts index 37f1d168c..276f0c787 100644 --- a/src/client.ts +++ b/src/client.ts @@ -667,7 +667,7 @@ export class MatrixClient extends EventEmitter { } return this.canResetTimelineCallback(roomId); }; - this.syncApi = new SyncApi(this, opts); + this.syncApi = new SyncApi(this, this.clientOpts); this.syncApi.sync(); if (opts.clientWellKnownPollPeriod !== undefined) { @@ -1420,6 +1420,13 @@ export class MatrixClient extends EventEmitter { return this.crypto.beginKeyVerification(method, userId, deviceId); } + public checkSecretStorageKey(key: any, info: any): Promise { // TODO: Types + if (!this.crypto) { + throw new Error("End-to-end encryption disabled"); + } + return this.crypto.checkSecretStorageKey(key, info); + } + /** * Set the global override for whether the client should ever send encrypted * messages to unverified devices. This provides the default for rooms which @@ -4876,14 +4883,7 @@ export class MatrixClient extends EventEmitter { highlights: [], }; - // TODO: @@TR: wtf is this - // prev: - /* - return this.search({ body: body }).then( - this._processRoomEventsSearch.bind(this, searchResults), - ); - */ - return this.search({ body: body }).then(res => this.processRoomEventsSearch(res, searchResults)); + return this.search({ body: body }).then(res => this.processRoomEventsSearch(searchResults, res)); } /** @@ -4911,12 +4911,11 @@ export class MatrixClient extends EventEmitter { next_batch: searchResults.next_batch, }; - // TODO: @@TR: wtf - const promise = this.search(searchOpts).then( - this.processRoomEventsSearch.bind(this, searchResults), - ).finally(() => { - searchResults.pendingRequest = null; - }); + const promise = this.search(searchOpts) + .then(res => this.processRoomEventsSearch(searchResults, res)) + .finally(() => { + searchResults.pendingRequest = null; + }); searchResults.pendingRequest = promise; return promise; diff --git a/src/crypto/SecretStorage.js b/src/crypto/SecretStorage.js index f835ef26b..a1ed647f0 100644 --- a/src/crypto/SecretStorage.js +++ b/src/crypto/SecretStorage.js @@ -444,7 +444,7 @@ export class SecretStorage extends EventEmitter { && this._incomingRequests[deviceId][content.request_id]) { logger.info("received request cancellation for secret (" + sender + ", " + deviceId + ", " + content.request_id + ")"); - this.baseApis.emit("crypto.secrets.requestCancelled", { + this._baseApis.emit("crypto.secrets.requestCancelled", { user_id: sender, device_id: deviceId, request_id: content.request_id, diff --git a/src/crypto/index.js b/src/crypto/index.js index 82df9dda1..a36e78a2a 100644 --- a/src/crypto/index.js +++ b/src/crypto/index.js @@ -495,7 +495,7 @@ Crypto.prototype.bootstrapCrossSigning = async function({ } = {}) { logger.log("Bootstrapping cross-signing"); - const delegateCryptoCallbacks = this.baseApis.cryptoCallbacks; + const delegateCryptoCallbacks = this._baseApis.cryptoCallbacks; const builder = new EncryptionSetupBuilder( this._baseApis.store.accountData, delegateCryptoCallbacks,