1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-04 05:02:41 +03:00

Add exportRoomKeys to CryptoBackend (#2970)

Element-web calls `exportRoomKeys` on logout, so we need a stub implementation
to get it EW working with the rust crypto sdk.
This commit is contained in:
Richard van der Hoff
2022-12-20 11:11:00 +00:00
committed by GitHub
parent b83c372848
commit 45f6c5b079
10 changed files with 102 additions and 34 deletions

View File

@@ -20,6 +20,7 @@ limitations under the License.
import { EmoteEvent, IPartialEvent, MessageEvent, NoticeEvent, Optional } from "matrix-events-sdk";
import type { IMegolmSessionData } from "./@types/crypto";
import { ISyncStateData, SyncApi, SyncState } from "./sync";
import {
EventStatus,
@@ -74,7 +75,6 @@ import {
ICryptoCallbacks,
IBootstrapCrossSigningOpts,
ICheckOwnCrossSigningTrustOpts,
IMegolmSessionData,
isCryptoAvailable,
VerificationMethod,
IRoomKeyRequestBody,
@@ -3034,10 +3034,10 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
* session export objects
*/
public exportRoomKeys(): Promise<IMegolmSessionData[]> {
if (!this.crypto) {
if (!this.cryptoBackend) {
return Promise.reject(new Error("End-to-end encryption disabled"));
}
return this.crypto.exportRoomKeys();
return this.cryptoBackend.exportRoomKeys();
}
/**