Skip to content

Commit 0a561a6

Browse files
committed
Switch to Rust crypto
We're not really using crypto at the moment, but with it being this easy, we should still make the switch!
1 parent 31a1c5e commit 0a561a6

File tree

4 files changed

+1
-52
lines changed

4 files changed

+1
-52
lines changed

src/@types/global.d.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ declare global {
2323
webkitFullscreenElement: HTMLElement | null;
2424
}
2525

26-
interface Window {
27-
// TODO: https://gitlab.matrix.org/matrix-org/olm/-/issues/10
28-
OLM_OPTIONS: Record<string, string>;
29-
}
30-
3126
interface HTMLElement {
3227
// Safari only supports this prefixed, so tell the type system about it
3328
webkitRequestFullscreen: () => void;

src/initializer.tsx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ enum LoadState {
3232
}
3333

3434
class DependencyLoadStates {
35-
// TODO: decide where olm should be initialized (see TODO comment below)
36-
// olm: LoadState = LoadState.None;
3735
public config: LoadState = LoadState.None;
3836
public sentry: LoadState = LoadState.None;
3937
public openTelemetry: LoadState = LoadState.None;
@@ -128,18 +126,6 @@ export class Initializer {
128126
private loadStates = new DependencyLoadStates();
129127

130128
private initStep(resolve: (value: void | PromiseLike<void>) => void): void {
131-
// TODO: Olm is initialized with the client currently (see `initClient()` and `olm.ts`)
132-
// we need to decide if we want to init it here or keep it in initClient
133-
// if (this.loadStates.olm === LoadState.None) {
134-
// this.loadStates.olm = LoadState.Loading;
135-
// // TODO: https://gitlab.matrix.org/matrix-org/olm/-/issues/10
136-
// window.OLM_OPTIONS = {};
137-
// Olm.init({ locateFile: () => olmWasmPath }).then(() => {
138-
// this.loadStates.olm = LoadState.Loaded;
139-
// this.initStep(resolve);
140-
// });
141-
// }
142-
143129
// config
144130
if (this.loadStates.config === LoadState.None) {
145131
this.loadStates.config = LoadState.Loading;

src/olm.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/utils/matrix.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import type { MatrixClient } from "matrix-js-sdk/src/client";
3434
import type { Room } from "matrix-js-sdk/src/models/room";
3535
import IndexedDBWorker from "../IndexedDBWorker?worker";
3636
import { generateUrlSearchParams, getUrlParams } from "../UrlParams";
37-
import { loadOlm } from "../olm";
3837
import { Config } from "../config/Config";
3938
import { E2eeType } from "../e2ee/e2eeType";
4039
import { EncryptionSystem, saveKeyForRoom } from "../e2ee/sharedKeyManagement";
@@ -97,8 +96,6 @@ export async function initClient(
9796
clientOptions: ICreateClientOpts,
9897
restore: boolean,
9998
): Promise<MatrixClient> {
100-
await loadOlm();
101-
10299
let indexedDB: IDBFactory | undefined;
103100
try {
104101
indexedDB = window.indexedDB;
@@ -198,7 +195,7 @@ export async function initClient(
198195
await client.store.startup();
199196
}
200197

201-
await client.initCrypto();
198+
await client.initRustCrypto();
202199
client.setGlobalErrorOnUnknownDevices(false);
203200
// Once startClient is called, syncs are run asynchronously.
204201
// Also, sync completion is communicated only via events.

0 commit comments

Comments
 (0)