Remove Features.RustCrypto
(#28582)
This commit is contained in:
parent
6798239aa8
commit
08418c16c9
3 changed files with 0 additions and 29 deletions
|
@ -35,13 +35,11 @@ import IdentityAuthClient from "./IdentityAuthClient";
|
||||||
import { crossSigningCallbacks } from "./SecurityManager";
|
import { crossSigningCallbacks } from "./SecurityManager";
|
||||||
import { SlidingSyncManager } from "./SlidingSyncManager";
|
import { SlidingSyncManager } from "./SlidingSyncManager";
|
||||||
import { _t, UserFriendlyError } from "./languageHandler";
|
import { _t, UserFriendlyError } from "./languageHandler";
|
||||||
import { SettingLevel } from "./settings/SettingLevel";
|
|
||||||
import MatrixClientBackedController from "./settings/controllers/MatrixClientBackedController";
|
import MatrixClientBackedController from "./settings/controllers/MatrixClientBackedController";
|
||||||
import ErrorDialog from "./components/views/dialogs/ErrorDialog";
|
import ErrorDialog from "./components/views/dialogs/ErrorDialog";
|
||||||
import PlatformPeg from "./PlatformPeg";
|
import PlatformPeg from "./PlatformPeg";
|
||||||
import { formatList } from "./utils/FormattingUtils";
|
import { formatList } from "./utils/FormattingUtils";
|
||||||
import SdkConfig from "./SdkConfig";
|
import SdkConfig from "./SdkConfig";
|
||||||
import { Features } from "./settings/Settings";
|
|
||||||
import { setDeviceIsolationMode } from "./settings/controllers/DeviceIsolationModeController.ts";
|
import { setDeviceIsolationMode } from "./settings/controllers/DeviceIsolationModeController.ts";
|
||||||
|
|
||||||
export interface IMatrixClientCreds {
|
export interface IMatrixClientCreds {
|
||||||
|
@ -333,11 +331,6 @@ class MatrixClientPegClass implements IMatrixClientPeg {
|
||||||
logger.error("Warning! Not using an encryption key for rust crypto store.");
|
logger.error("Warning! Not using an encryption key for rust crypto store.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Record the fact that we used the Rust crypto stack with this client. This just guards against people
|
|
||||||
// rolling back to versions of EW that did not default to Rust crypto (which would lead to an error, since
|
|
||||||
// we cannot migrate from Rust to Legacy crypto).
|
|
||||||
await SettingsStore.setValue(Features.RustCrypto, null, SettingLevel.DEVICE, true);
|
|
||||||
|
|
||||||
await this.matrixClient.initRustCrypto({
|
await this.matrixClient.initRustCrypto({
|
||||||
storageKey: rustCryptoStoreKey,
|
storageKey: rustCryptoStoreKey,
|
||||||
storagePassword: rustCryptoStorePassword,
|
storagePassword: rustCryptoStorePassword,
|
||||||
|
|
|
@ -90,13 +90,6 @@ export enum Features {
|
||||||
NotificationSettings2 = "feature_notification_settings2",
|
NotificationSettings2 = "feature_notification_settings2",
|
||||||
OidcNativeFlow = "feature_oidc_native_flow",
|
OidcNativeFlow = "feature_oidc_native_flow",
|
||||||
ReleaseAnnouncement = "feature_release_announcement",
|
ReleaseAnnouncement = "feature_release_announcement",
|
||||||
|
|
||||||
/** If true, use the Rust crypto implementation.
|
|
||||||
*
|
|
||||||
* This is no longer read, but we continue to populate it on all devices, to guard against people rolling back to
|
|
||||||
* old versions of EW that do not use rust crypto by default.
|
|
||||||
*/
|
|
||||||
RustCrypto = "feature_rust_crypto",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const labGroupNames: Record<LabGroup, TranslationKey> = {
|
export const labGroupNames: Record<LabGroup, TranslationKey> = {
|
||||||
|
@ -469,10 +462,6 @@ export const SETTINGS: { [setting: string]: ISetting } = {
|
||||||
description: _td("labs|oidc_native_flow_description"),
|
description: _td("labs|oidc_native_flow_description"),
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
[Features.RustCrypto]: {
|
|
||||||
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
/**
|
/**
|
||||||
* @deprecated in favor of {@link fontSizeDelta}
|
* @deprecated in favor of {@link fontSizeDelta}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -11,8 +11,6 @@ import fetchMockJest from "fetch-mock-jest";
|
||||||
|
|
||||||
import { advanceDateAndTime, stubClient } from "../test-utils";
|
import { advanceDateAndTime, stubClient } from "../test-utils";
|
||||||
import { IMatrixClientPeg, MatrixClientPeg as peg } from "../../src/MatrixClientPeg";
|
import { IMatrixClientPeg, MatrixClientPeg as peg } from "../../src/MatrixClientPeg";
|
||||||
import SettingsStore from "../../src/settings/SettingsStore";
|
|
||||||
import { SettingLevel } from "../../src/settings/SettingLevel";
|
|
||||||
|
|
||||||
jest.useFakeTimers();
|
jest.useFakeTimers();
|
||||||
|
|
||||||
|
@ -81,27 +79,18 @@ describe("MatrixClientPeg", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should initialise the rust crypto library by default", async () => {
|
it("should initialise the rust crypto library by default", async () => {
|
||||||
const mockSetValue = jest.spyOn(SettingsStore, "setValue").mockResolvedValue(undefined);
|
|
||||||
|
|
||||||
const mockInitRustCrypto = jest.spyOn(testPeg.safeGet(), "initRustCrypto").mockResolvedValue(undefined);
|
const mockInitRustCrypto = jest.spyOn(testPeg.safeGet(), "initRustCrypto").mockResolvedValue(undefined);
|
||||||
|
|
||||||
const cryptoStoreKey = new Uint8Array([1, 2, 3, 4]);
|
const cryptoStoreKey = new Uint8Array([1, 2, 3, 4]);
|
||||||
await testPeg.start({ rustCryptoStoreKey: cryptoStoreKey });
|
await testPeg.start({ rustCryptoStoreKey: cryptoStoreKey });
|
||||||
expect(mockInitRustCrypto).toHaveBeenCalledWith({ storageKey: cryptoStoreKey });
|
expect(mockInitRustCrypto).toHaveBeenCalledWith({ storageKey: cryptoStoreKey });
|
||||||
|
|
||||||
// we should have stashed the setting in the settings store
|
|
||||||
expect(mockSetValue).toHaveBeenCalledWith("feature_rust_crypto", null, SettingLevel.DEVICE, true);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should migrate existing login", async () => {
|
it("Should migrate existing login", async () => {
|
||||||
const mockSetValue = jest.spyOn(SettingsStore, "setValue").mockResolvedValue(undefined);
|
|
||||||
const mockInitRustCrypto = jest.spyOn(testPeg.safeGet(), "initRustCrypto").mockResolvedValue(undefined);
|
const mockInitRustCrypto = jest.spyOn(testPeg.safeGet(), "initRustCrypto").mockResolvedValue(undefined);
|
||||||
|
|
||||||
await testPeg.start();
|
await testPeg.start();
|
||||||
expect(mockInitRustCrypto).toHaveBeenCalledTimes(1);
|
expect(mockInitRustCrypto).toHaveBeenCalledTimes(1);
|
||||||
|
|
||||||
// we should have stashed the setting in the settings store
|
|
||||||
expect(mockSetValue).toHaveBeenCalledWith("feature_rust_crypto", null, SettingLevel.DEVICE, true);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue