Skip to content

Commit 66b79f5

Browse files
authored
Merge pull request #2571 from element-hq/hughns/rust-crypto
Use Rust crypto implementation
2 parents 61a2426 + 36ce21d commit 66b79f5

File tree

8 files changed

+9
-58
lines changed

8 files changed

+9
-58
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"@juggle/resize-observer": "^3.3.1",
2323
"@livekit/components-core": "^0.11.0",
2424
"@livekit/components-react": "^2.0.0",
25-
"@matrix-org/olm": "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.14.tgz",
2625
"@opentelemetry/api": "^1.4.0",
2726
"@opentelemetry/context-zone": "^1.9.1",
2827
"@opentelemetry/exporter-jaeger": "^1.9.1",

public/locales/en-GB/app.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"username": "Username",
6060
"video": "Video"
6161
},
62+
"crypto_version": "Crypto version: {{version}}",
6263
"device_id": "Device ID: {{id}}",
6364
"disconnected_banner": "Connectivity to the server has been lost.",
6465
"full_screen_view_description": "<0>Submitting debug logs will help us track down the problem.</0>",
@@ -156,7 +157,7 @@
156157
"unauthenticated_view_eula_caption": "By clicking \"Go\", you agree to our <2>End User Licensing Agreement (EULA)</2>",
157158
"unauthenticated_view_login_button": "Login to your account",
158159
"unmute_microphone_button_label": "Unmute microphone",
159-
"version": "Version: {{version}}",
160+
"version": "{{productName}} version: {{version}}",
160161
"video_tile": {
161162
"always_show": "Always show",
162163
"change_fit_contain": "Fit to frame",

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/matrix-utils.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.

src/olm.ts

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

src/settings/SettingsModal.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,15 @@ export const SettingsModal: FC<Props> = ({
241241
>
242242
<p>
243243
{t("version", {
244+
productName: import.meta.env.VITE_PRODUCT_NAME || "Element Call",
244245
version: import.meta.env.VITE_APP_VERSION || "dev",
245246
})}
246247
</p>
248+
<p>
249+
{t("crypto_version", {
250+
version: client.getCrypto()?.getVersion() || "unknown",
251+
})}
252+
</p>
247253
<p>
248254
{t("matrix_id", {
249255
id: client.getUserId() || "unknown",

yarn.lock

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1924,10 +1924,6 @@
19241924
resolved "https://registry.yarnpkg.com/@matrix-org/olm/-/olm-3.2.15.tgz#55f3c1b70a21bbee3f9195cecd6846b1083451ec"
19251925
integrity sha512-S7lOrndAK9/8qOtaTq/WhttJC/o4GAzdfK0MUPpo8ApzsJEC0QjtwrkC3KBXdFP1cD1MXi/mlKR7aaoVMKgs6Q==
19261926

1927-
"@matrix-org/olm@https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.14.tgz":
1928-
version "3.2.14"
1929-
resolved "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.14.tgz#acd96c00a881d0f462e1f97a56c73742c8dbc984"
1930-
19311927
"@nodelib/[email protected]":
19321928
version "2.1.5"
19331929
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"

0 commit comments

Comments
 (0)