Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove remaining legacy crypto imports in new crypto and tests #4491

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions spec/integ/crypto/crypto.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ import {
OnlySignedDevicesIsolationMode,
} from "../../../src/crypto-api";
import { E2EKeyResponder } from "../../test-utils/E2EKeyResponder";
import { IKeyBackup } from "../../../src/crypto/backup";
import {
createOlmAccount,
createOlmSession,
Expand All @@ -106,6 +105,7 @@ import { ToDevicePayload } from "../../../src/models/ToDeviceMessage";
import { AccountDataAccumulator } from "../../test-utils/AccountDataAccumulator";
import { UNSIGNED_MEMBERSHIP_FIELD } from "../../../src/@types/event";
import { KnownMembership } from "../../../src/@types/membership";
import { KeyBackup } from "../../../src/rust-crypto/backup.ts";

afterEach(() => {
// reset fake-indexeddb after each test, to make sure we don't leak connections
Expand Down Expand Up @@ -3138,11 +3138,11 @@ describe.each(Object.entries(CRYPTO_BACKENDS))("crypto (%s)", (backend: string,
// Import a new key that should be uploaded
const newKey = testData.MEGOLM_SESSION_DATA;

const awaitKeyUploaded = new Promise<IKeyBackup>((resolve) => {
const awaitKeyUploaded = new Promise<KeyBackup>((resolve) => {
fetchMock.put(
"path:/_matrix/client/v3/room_keys/keys",
(url, request) => {
const uploadPayload: IKeyBackup = JSON.parse(request.body?.toString() ?? "{}");
const uploadPayload: KeyBackup = JSON.parse(request.body?.toString() ?? "{}");
resolve(uploadPayload);
return {
status: 200,
Expand Down
4 changes: 2 additions & 2 deletions spec/integ/crypto/megolm-backup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ import {
} from "../../test-utils/test-utils";
import * as testData from "../../test-utils/test-data";
import { KeyBackupInfo, KeyBackupSession } from "../../../src/crypto-api/keybackup";
import { IKeyBackup } from "../../../src/crypto/backup";
import { flushPromises } from "../../test-utils/flushPromises";
import { defer, IDeferred } from "../../../src/utils";
import { DecryptionFailureCode } from "../../../src/crypto-api";
import { KeyBackup } from "../../../src/rust-crypto/backup.ts";

const ROOM_ID = testData.TEST_ROOM_ID;

Expand Down Expand Up @@ -91,7 +91,7 @@ function mockUploadEmitter(
},
};
}
const uploadPayload: IKeyBackup = JSON.parse(request.body?.toString() ?? "{}");
const uploadPayload: KeyBackup = JSON.parse(request.body?.toString() ?? "{}");
let count = 0;
for (const [roomId, value] of Object.entries(uploadPayload.rooms)) {
for (const sessionId of Object.keys(value.sessions)) {
Expand Down
6 changes: 3 additions & 3 deletions src/rust-crypto/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ import { StoreHandle } from "@matrix-org/matrix-sdk-crypto-wasm";
import { RustCrypto } from "./rust-crypto.ts";
import { IHttpOpts, MatrixHttpApi } from "../http-api/index.ts";
import { ServerSideSecretStorage } from "../secret-storage.ts";
import { ICryptoCallbacks } from "../crypto/index.ts";
import { Logger } from "../logger.ts";
import { CryptoStore, MigrationState } from "../crypto/store/base.ts";
import {
migrateFromLegacyCrypto,
migrateLegacyLocalTrustIfNeeded,
migrateRoomSettingsFromLegacyCrypto,
} from "./libolm_migration.ts";
import { CryptoCallbacks } from "../crypto-api/index.ts";

/**
* Create a new `RustCrypto` implementation
Expand Down Expand Up @@ -55,7 +55,7 @@ export async function initRustCrypto(args: {
secretStorage: ServerSideSecretStorage;

/** Crypto callbacks provided by the application. */
cryptoCallbacks: ICryptoCallbacks;
cryptoCallbacks: CryptoCallbacks;

/**
* The prefix to use on the indexeddbs created by rust-crypto.
Expand Down Expand Up @@ -145,7 +145,7 @@ async function initOlmMachine(
userId: string,
deviceId: string,
secretStorage: ServerSideSecretStorage,
cryptoCallbacks: ICryptoCallbacks,
cryptoCallbacks: CryptoCallbacks,
storeHandle: StoreHandle,
legacyCryptoStore?: CryptoStore,
): Promise<RustCrypto> {
Expand Down
Loading