From 5bf825a5c53cebf30821607f2f5b2ade848c1509 Mon Sep 17 00:00:00 2001 From: Olivier D Date: Fri, 25 Aug 2023 10:28:46 +0200 Subject: [PATCH] chore : remove xsss activation feature flag from patches (#644) * remove xsss activation feature flag from patch * remove feature flags in config.json * deprecate code from Tchap UI feature related to xsss * remove unused code from patches * remove unused feature flags * remove depreacted code --- config.dev.json | 4 +- config.preprod.json | 4 +- config.prod.json | 4 +- .../matrix-js-sdk+25.0.0.patch | 40 ----- .../matrix-react-sdk+3.71.1.patch | 159 ++---------------- .../matrix-react-sdk+3.71.1.patch | 63 +------ patches/patches.json | 6 - src/tchap/lib/IncomingKeyRequestHandler.ts | 34 +++- src/tchap/util/TchapUIFeature.ts | 37 ---- src/tchap/util/TchapUrls.ts | 3 + src/tchap/util/TchapUserSettings.ts | 12 +- src/tchap/util/TchapUtils.ts | 1 + 12 files changed, 68 insertions(+), 299 deletions(-) delete mode 100644 patches/activate-cross-signing-and-secure-storage-js/matrix-js-sdk+25.0.0.patch diff --git a/config.dev.json b/config.dev.json index 956214bad6..f2a80ae360 100644 --- a/config.dev.json +++ b/config.dev.json @@ -37,9 +37,7 @@ "features": { "feature_thread": true, "feature_video_rooms": false, - "feature_new_device_manager": false, - "tchap_activate_cross_signing_and_secure_storage": true, - "tchap_disable_cross_signing_setup_toast": false + "feature_new_device_manager": false }, "default_federate": true, "default_theme": "light", diff --git a/config.preprod.json b/config.preprod.json index a7b05d479d..25acef0f9c 100644 --- a/config.preprod.json +++ b/config.preprod.json @@ -32,9 +32,7 @@ "features": { "feature_thread": true, "feature_video_rooms": false, - "feature_new_device_manager": false, - "tchap_activate_cross_signing_and_secure_storage": true, - "tchap_disable_cross_signing_setup_toast": false + "feature_new_device_manager": false }, "default_federate": true, "default_theme": "light", diff --git a/config.prod.json b/config.prod.json index ce441758e8..ceb8e12af5 100644 --- a/config.prod.json +++ b/config.prod.json @@ -107,9 +107,7 @@ "features": { "feature_thread": true, "feature_video_rooms": false, - "feature_new_device_manager": false, - "tchap_activate_cross_signing_and_secure_storage": true, - "tchap_disable_cross_signing_setup_toast": false + "feature_new_device_manager": false }, "default_federate": true, "default_theme": "light", diff --git a/patches/activate-cross-signing-and-secure-storage-js/matrix-js-sdk+25.0.0.patch b/patches/activate-cross-signing-and-secure-storage-js/matrix-js-sdk+25.0.0.patch deleted file mode 100644 index dcbbed3b81..0000000000 --- a/patches/activate-cross-signing-and-secure-storage-js/matrix-js-sdk+25.0.0.patch +++ /dev/null @@ -1,40 +0,0 @@ -diff --git a/node_modules/matrix-js-sdk/src/client.ts b/node_modules/matrix-js-sdk/src/client.ts -index cb8df7a..1ca2f21 100644 ---- a/node_modules/matrix-js-sdk/src/client.ts -+++ b/node_modules/matrix-js-sdk/src/client.ts -@@ -20,6 +20,7 @@ limitations under the License. - - import { Optional } from "matrix-events-sdk"; - -+ - import type { IDeviceKeys, IMegolmSessionData, IOneTimeKey } from "./@types/crypto"; - import { ISyncStateData, SyncApi, SyncApiOptions, SyncState } from "./sync"; - import { -@@ -214,6 +215,9 @@ import { - ServerSideSecretStorageImpl, - } from "./secret-storage"; - -+import TchapUIFeature from '../../../src/tchap/util/TchapUIFeature'; // :TCHAP: -+ -+ - export type Store = IStore; - - export type ResetTimelineCallback = (roomId: string) => boolean; -@@ -7284,6 +7288,17 @@ export class MatrixClient extends TypedEventEmitter { - cli.on(HttpApiEvent.SessionLoggedOut, () => dft.stop()); - cli.on(MatrixEventEvent.Decrypted, (e, err) => dft.eventDecrypted(e, err as DecryptionError)); - -+ //:tchap: add listener to handle incomingKeyRequest and trigger legacy verification process -+ //the one with the emoji -+ //this listener can be forced with forceLegacyIncomingRoomKeyVerification -+ //or is added only if the xs is not active -+ if(TchapUIFeature.forceLegacyIncomingRoomKeyVerification || -+ !TchapUIFeature.isCrossSigningAndSecureStorageActive()){ -+ /* :TCHAP: Désactiver le partage legacy de clefs avec les appareils mobiles */ -+ console.log(':tchap: activate the legacy incoming key verification') -+ /* end :TCHAP: */ -+ const krh = new KeyRequestHandler(cli); -+ cli.on(CryptoEvent.RoomKeyRequest, (req) => { -+ krh.handleKeyRequest(req); -+ }); -+ -+ cli.on(CryptoEvent.RoomKeyRequestCancellation, (req) => { -+ krh.handleKeyRequestCancellation(req); -+ }); -+ } -+ //:tchap: end of tchap -+ - cli.on(ClientEvent.Room, (room) => { - if (MatrixClientPeg.get().isCryptoEnabled()) { - const blacklistEnabled = SettingsStore.getValueAt( -@@ -1716,6 +1739,15 @@ export default class MatrixChat extends React.PureComponent { +@@ -1716,6 +1717,15 @@ export default class MatrixChat extends React.PureComponent { return; } -+ //:tchap: -+ if (screen === "sauvegarde-automatique") { ++ //:tchap: add a screen to open user tab security ++ if (screen === TchapUrls.secureBackupFragment) { + //open the security tab + //there is no anchor to sauvegarde-automatique subection + const payload: OpenToTabPayload = { action: Action.ViewUserSettings, initialTabId: UserTab.Security }; @@ -63,18 +27,10 @@ index 575ff07..ec8c98b 100644 dis.dispatch({ action: "start_registration", diff --git a/node_modules/matrix-react-sdk/src/components/views/settings/CrossSigningPanel.tsx b/node_modules/matrix-react-sdk/src/components/views/settings/CrossSigningPanel.tsx -index e3f62d4..24c7f46 100644 +index e3f62d4..dab34a8 100644 --- a/node_modules/matrix-react-sdk/src/components/views/settings/CrossSigningPanel.tsx +++ b/node_modules/matrix-react-sdk/src/components/views/settings/CrossSigningPanel.tsx -@@ -28,6 +28,7 @@ import ConfirmDestroyCrossSigningDialog from "../dialogs/security/ConfirmDestroy - import SetupEncryptionDialog from "../dialogs/security/SetupEncryptionDialog"; - import { accessSecretStorage } from "../../../SecurityManager"; - import AccessibleButton from "../elements/AccessibleButton"; -+import TchapUIFeature from "../../../../../../src/tchap/util/TchapUIFeature"; // :TCHAP: - - interface IState { - error?: Error; -@@ -210,14 +211,21 @@ export default class CrossSigningPanel extends React.PureComponent<{}, IState> { +@@ -210,14 +210,21 @@ export default class CrossSigningPanel extends React.PureComponent<{}, IState> { userSigningPrivateKeyCached; const actions: JSX.Element[] = []; @@ -98,7 +54,7 @@ index e3f62d4..24c7f46 100644 {buttonCaption} , -@@ -225,7 +233,9 @@ export default class CrossSigningPanel extends React.PureComponent<{}, IState> { +@@ -225,7 +232,9 @@ export default class CrossSigningPanel extends React.PureComponent<{}, IState> { } if (keysExistAnywhere) { @@ -109,7 +65,7 @@ index e3f62d4..24c7f46 100644 {_t("Reset")} , -@@ -237,6 +247,19 @@ export default class CrossSigningPanel extends React.PureComponent<{}, IState> { +@@ -237,6 +246,12 @@ export default class CrossSigningPanel extends React.PureComponent<{}, IState> { actionRow =
{actions}
; } @@ -119,17 +75,10 @@ index e3f62d4..24c7f46 100644 + advancedActionRow =
{advancedActions}
; + } + // end :TCHAP: -+ -+ // :TCHAP: hide cross-signing actions if cross-signing is not supported -+ if (!TchapUIFeature.isCrossSigningAndSecureStorageActive()) { -+ actionRow = null; -+ } -+ // end :TCHAP: -+ return (
{summarisedStatus} -@@ -274,6 +297,7 @@ export default class CrossSigningPanel extends React.PureComponent<{}, IState> { +@@ -274,6 +289,7 @@ export default class CrossSigningPanel extends React.PureComponent<{}, IState> { @@ -137,66 +86,11 @@ index e3f62d4..24c7f46 100644 {errorSection} {actionRow} -diff --git a/node_modules/matrix-react-sdk/src/components/views/settings/DevicesPanel.tsx b/node_modules/matrix-react-sdk/src/components/views/settings/DevicesPanel.tsx -index 603438e..ea4d47c 100644 ---- a/node_modules/matrix-react-sdk/src/components/views/settings/DevicesPanel.tsx -+++ b/node_modules/matrix-react-sdk/src/components/views/settings/DevicesPanel.tsx -@@ -27,6 +27,7 @@ import AccessibleButton from "../elements/AccessibleButton"; - import { deleteDevicesWithInteractiveAuth } from "./devices/deleteDevices"; - import MatrixClientContext from "../../../contexts/MatrixClientContext"; - import { isDeviceVerified } from "../../../utils/device/isDeviceVerified"; -+import TchapUtils from '../../../../../../src/tchap/util/TchapUtils'; - - interface IProps { - className?: string; -@@ -37,6 +38,7 @@ interface IState { - deviceLoadError?: string; - selectedDevices: string[]; - deleting?: boolean; -+ isCrossSigningSupported?: boolean;//:tchap: add a state to detect if crossSigning is supported - } - - export default class DevicesPanel extends React.Component { -@@ -54,6 +56,12 @@ export default class DevicesPanel extends React.Component { - } - - public componentDidMount(): void { -+ //:tchap: Detect cross signing support once -+ TchapUtils.isCrossSigningSupportedByServer().then((isCrossSigningSupported)=>{ -+ this.setState({isCrossSigningSupported: isCrossSigningSupported}) -+ }); -+ //:end of tchap -+ - this.context.on(CryptoEvent.DevicesUpdated, this.onDevicesUpdated); - this.loadDevices(); - } -@@ -120,6 +128,13 @@ export default class DevicesPanel extends React.Component { - } - - private isDeviceVerified(device: IMyDevice): boolean | null { -+ //:tchap: if cross signing is not supported, use the legacy device check -+ const cli = this.context; -+ if (!this.state.isCrossSigningSupported) { -+ return cli.checkDeviceTrust(cli.getUserId(), device.device_id).isVerified(); -+ } -+ //:tchap: end -+ - return isDeviceVerified(this.context, device.device_id); - } - diff --git a/node_modules/matrix-react-sdk/src/components/views/settings/SecureBackupPanel.tsx b/node_modules/matrix-react-sdk/src/components/views/settings/SecureBackupPanel.tsx -index 7473786..af8b424 100644 +index 7473786..89bd1bf 100644 --- a/node_modules/matrix-react-sdk/src/components/views/settings/SecureBackupPanel.tsx +++ b/node_modules/matrix-react-sdk/src/components/views/settings/SecureBackupPanel.tsx -@@ -31,6 +31,7 @@ import AccessibleButton from "../elements/AccessibleButton"; - import QuestionDialog from "../dialogs/QuestionDialog"; - import RestoreKeyBackupDialog from "../dialogs/security/RestoreKeyBackupDialog"; - import { accessSecretStorage } from "../../../SecurityManager"; -+import TchapUIFeature from "../../../../../../src/tchap/util/TchapUIFeature"; // :TCHAP: - - interface IState { - loading: boolean; -@@ -248,6 +249,13 @@ export default class SecureBackupPanel extends React.PureComponent<{}, IState> { +@@ -248,6 +248,13 @@ export default class SecureBackupPanel extends React.PureComponent<{}, IState> { statusDescription = ( <>

@@ -210,7 +104,7 @@ index 7473786..af8b424 100644 {_t( "This session is not backing up your keys, " + "but you do have an existing backup you can restore from " + -@@ -261,7 +269,7 @@ export default class SecureBackupPanel extends React.PureComponent<{}, IState> { +@@ -261,7 +268,7 @@ export default class SecureBackupPanel extends React.PureComponent<{}, IState> { "Connect this session to key backup before signing out to avoid " + "losing any keys that may only be on this session.", )} @@ -219,7 +113,7 @@ index 7473786..af8b424 100644 ); restoreButtonCaption = _t("Connect this session to Key Backup"); -@@ -415,13 +423,15 @@ export default class SecureBackupPanel extends React.PureComponent<{}, IState> { +@@ -415,13 +422,15 @@ export default class SecureBackupPanel extends React.PureComponent<{}, IState> { , ); @@ -242,7 +136,7 @@ index 7473786..af8b424 100644 } else { statusDescription = ( <> -@@ -432,7 +442,7 @@ export default class SecureBackupPanel extends React.PureComponent<{}, IState> { +@@ -432,7 +441,7 @@ export default class SecureBackupPanel extends React.PureComponent<{}, IState> { { b: (sub) => {sub} }, )}

@@ -251,7 +145,7 @@ index 7473786..af8b424 100644 ); actions.push( -@@ -445,7 +455,9 @@ export default class SecureBackupPanel extends React.PureComponent<{}, IState> { +@@ -445,7 +454,9 @@ export default class SecureBackupPanel extends React.PureComponent<{}, IState> { if (secretStorageKeyInAccount) { actions.push( @@ -262,17 +156,7 @@ index 7473786..af8b424 100644 , ); } -@@ -463,17 +475,24 @@ export default class SecureBackupPanel extends React.PureComponent<{}, IState> { - let actionRow; - if (actions.length) { - actionRow =
{actions}
; -+ // :TCHAP: hide action buttons if secure storage is not supported -+ // actionRow =
{actions}
; -+ if (!TchapUIFeature.isCrossSigningAndSecureStorageActive()) { -+ actionRow = null; -+ } -+ // end :TCHAP: - } +@@ -467,7 +478,7 @@ export default class SecureBackupPanel extends React.PureComponent<{}, IState> { return (
@@ -281,10 +165,3 @@ index 7473786..af8b424 100644 {_t( "Back up your encryption keys with your account data in case you " + "lose access to your sessions. Your keys will be secured with a " + - "unique Security Key.", - )} -

-+ - {statusDescription} -
- {_t("Advanced")} diff --git a/patches/cross-signing-ui/matrix-react-sdk+3.71.1.patch b/patches/cross-signing-ui/matrix-react-sdk+3.71.1.patch index fe68d8df0a..3844d22c0c 100644 --- a/patches/cross-signing-ui/matrix-react-sdk+3.71.1.patch +++ b/patches/cross-signing-ui/matrix-react-sdk+3.71.1.patch @@ -108,18 +108,10 @@ index 3e48739..926d18b 100644 kind="primary" className="mx_Dialog_primary mx_CreateSecretStorageDialog_recoveryKeyButtons_copyBtn" diff --git a/node_modules/matrix-react-sdk/src/components/structures/auth/CompleteSecurity.tsx b/node_modules/matrix-react-sdk/src/components/structures/auth/CompleteSecurity.tsx -index 3171a0e..0c8555a 100644 +index 3171a0e..28c510d 100644 --- a/node_modules/matrix-react-sdk/src/components/structures/auth/CompleteSecurity.tsx +++ b/node_modules/matrix-react-sdk/src/components/structures/auth/CompleteSecurity.tsx -@@ -22,6 +22,7 @@ import SetupEncryptionBody from "./SetupEncryptionBody"; - import AccessibleButton from "../../views/elements/AccessibleButton"; - import CompleteSecurityBody from "../../views/auth/CompleteSecurityBody"; - import AuthPage from "../../views/auth/AuthPage"; -+import TchapUIFeature from "../../../../../../src/tchap/util/TchapUIFeature"; - - interface IProps { - onFinished: () => void; -@@ -66,7 +67,9 @@ export default class CompleteSecurity extends React.Component { +@@ -66,7 +66,9 @@ export default class CompleteSecurity extends React.Component { return null; } else if (phase === Phase.Intro) { if (lostKeys) { @@ -130,7 +122,7 @@ index 3171a0e..0c8555a 100644 title = _t("Unable to verify this device"); } else { icon = ; -@@ -92,9 +95,16 @@ export default class CompleteSecurity extends React.Component { +@@ -92,9 +94,16 @@ export default class CompleteSecurity extends React.Component { let skipButton; if (phase === Phase.Intro || phase === Phase.ConfirmReset) { @@ -143,13 +135,13 @@ index 3171a0e..0c8555a 100644 - onClick={this.onSkipClick} + // :tchap: remove onClick={this.onSkipClick} + // add instead -+ onClick={TchapUIFeature.isCrossSigningAndSecureStorageActive() ? tchapOnSkipClick : this.onSkipClick} ++ onClick={tchapOnSkipClick} + // end :tchap: className="mx_CompleteSecurity_skip" aria-label={_t("Skip verification for now")} /> diff --git a/node_modules/matrix-react-sdk/src/components/structures/auth/SetupEncryptionBody.tsx b/node_modules/matrix-react-sdk/src/components/structures/auth/SetupEncryptionBody.tsx -index 2cbfbf8..efe6b26 100644 +index 2cbfbf8..17e3d2f 100644 --- a/node_modules/matrix-react-sdk/src/components/structures/auth/SetupEncryptionBody.tsx +++ b/node_modules/matrix-react-sdk/src/components/structures/auth/SetupEncryptionBody.tsx @@ -28,6 +28,10 @@ import { SetupEncryptionStore, Phase } from "../../../stores/SetupEncryptionStor @@ -163,21 +155,7 @@ index 2cbfbf8..efe6b26 100644 function keyHasPassphrase(keyInfo: ISecretStorageKeyInfo): boolean { return Boolean(keyInfo.passphrase && keyInfo.passphrase.salt && keyInfo.passphrase.iterations); -@@ -81,6 +85,13 @@ export default class SetupEncryptionBody extends React.Component - store.stop(); - } - -+ private openDeviceTab = async (): Promise => { -+ const store = SetupEncryptionStore.sharedInstance(); -+ store.skipConfirm(); -+ const payload: OpenToTabPayload = { action: Action.ViewUserSettings, initialTabId: UserTab.Security }; -+ defaultDispatcher.dispatch(payload); -+ }; -+ - private onUsePassphraseClick = async (): Promise => { - const store = SetupEncryptionStore.sharedInstance(); - store.usePassPhrase(); -@@ -160,17 +171,27 @@ export default class SetupEncryptionBody extends React.Component +@@ -160,17 +164,27 @@ export default class SetupEncryptionBody extends React.Component return (

@@ -289,18 +267,10 @@ index 94cf02d..8deef31 100644 className = "mx_DecryptionFailureBar"; headline = {_t("Some messages could not be decrypted")}; diff --git a/node_modules/matrix-react-sdk/src/toasts/SetupEncryptionToast.ts b/node_modules/matrix-react-sdk/src/toasts/SetupEncryptionToast.ts -index 3b60705..a11711d 100644 +index 3b60705..80565f8 100644 --- a/node_modules/matrix-react-sdk/src/toasts/SetupEncryptionToast.ts +++ b/node_modules/matrix-react-sdk/src/toasts/SetupEncryptionToast.ts -@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and - limitations under the License. - */ - -+import TchapUIFeature from "../../../../src/tchap/util/TchapUIFeature"; - import Modal from "../Modal"; - import { _t } from "../languageHandler"; - import DeviceListener from "../DeviceListener"; -@@ -50,7 +51,9 @@ const getIcon = (kind: Kind): string => { +@@ -50,7 +50,9 @@ const getIcon = (kind: Kind): string => { const getSetupCaption = (kind: Kind): string => { switch (kind) { case Kind.SET_UP_ENCRYPTION: @@ -311,20 +281,3 @@ index 3b60705..a11711d 100644 case Kind.UPGRADE_ENCRYPTION: return _t("Upgrade"); case Kind.VERIFY_THIS_SESSION: -@@ -79,6 +82,16 @@ const onReject = (): void => { - }; - - export const showToast = (kind: Kind): void => { -+ /* :TCHAP: hide cross-signing setup toast when feature flag tchap_disable_cross_signing_setup_toast is on */ -+ if ( -+ TchapUIFeature.isCrossSigningAndSecureStorageActive() -+ && TchapUIFeature.isCrossSigningSetupToastDisabled() -+ && (kind === Kind.SET_UP_ENCRYPTION || kind === Kind.UPGRADE_ENCRYPTION) -+ ) { -+ return; -+ } -+ /* end :TCHAP: */ -+ - if (SecurityCustomisations.setupEncryptionNeeded?.(kind)) { - return; - } diff --git a/patches/patches.json b/patches/patches.json index fe321d84c6..c037753f85 100644 --- a/patches/patches.json +++ b/patches/patches.json @@ -141,12 +141,6 @@ "package": "matrix-react-sdk", "files": ["src/utils/MultiInviter.ts"] }, - "activate-cross-signing-and-secure-storage-js": { - "comments": "introduce a feature flag for activating cross signing and secure storage", - "github-issue": "https://github.com/tchapgouv/tchap-web-v4/issues/433", - "package": "matrix-js-sdk", - "files": ["src/client.ts"] - }, "activate-cross-signing-and-secure-storage-react": { "comments": "introduce a feature flag for activating cross signing and secure storage (unify previous patches)", "github-issue": "https://github.com/tchapgouv/tchap-web-v4/issues/433, https://github.com/tchapgouv/tchap-web-v4/issues/540", diff --git a/src/tchap/lib/IncomingKeyRequestHandler.ts b/src/tchap/lib/IncomingKeyRequestHandler.ts index b22ffda386..8452bfa572 100644 --- a/src/tchap/lib/IncomingKeyRequestHandler.ts +++ b/src/tchap/lib/IncomingKeyRequestHandler.ts @@ -4,9 +4,39 @@ import Modal from "matrix-react-sdk/src/Modal"; import { hideToast as hideUnverifiedSessionsToast } from "matrix-react-sdk/src/toasts/UnverifiedSessionToast"; /** - * :tchap: inspired from +@deprecated +* :tchap: inspired from * https://github.com/matrix-org/matrix-react-sdk/blob/515304d32ebcfee403791c6f4f11a5ecc29e9e65/src/KeyRequestHandler.js - */ + + +This class was used in MatrixChat +// legacy export + export { default as Views } from "../../Views"; +@@ -1587,6 +1590,26 @@ export default class MatrixChat extends React.PureComponent { + cli.on(HttpApiEvent.SessionLoggedOut, () => dft.stop()); + cli.on(MatrixEventEvent.Decrypted, (e, err) => dft.eventDecrypted(e, err as DecryptionError)); + ++ //:tchap: add listener to handle incomingKeyRequest and trigger legacy verification process ++ //the one with the emoji ++ //this listener can be forced with forceLegacyIncomingRoomKeyVerification ++ //or is added only if the xs is not active ++ if(TchapUIFeature.forceLegacyIncomingRoomKeyVerification || ++ !TchapUIFeature.isCrossSigningAndSecureStorageActive()){ ++ //TCHAP: Désactiver le partage legacy de clefs avec les appareils mobiles ++ console.log(':tchap: activate the legacy incoming key verification') ++ const krh = new KeyRequestHandler(cli); ++ cli.on(CryptoEvent.RoomKeyRequest, (req) => { ++ krh.handleKeyRequest(req); ++ }); ++ ++ cli.on(CryptoEvent.RoomKeyRequestCancellation, (req) => { ++ krh.handleKeyRequestCancellation(req); ++ }); ++ } ++ //:tchap: end of tchap ++ + +*/ export default class KeyRequestHandler { private _matrixClient; private _currentUser: string; diff --git a/src/tchap/util/TchapUIFeature.ts b/src/tchap/util/TchapUIFeature.ts index db42d98ca2..1edf29dbfc 100644 --- a/src/tchap/util/TchapUIFeature.ts +++ b/src/tchap/util/TchapUIFeature.ts @@ -2,8 +2,6 @@ * Tchap UI Feature flags */ -import SdkConfig from "matrix-react-sdk/src/SdkConfig"; - export default class TchapUIFeature { /** * This flag controls weither space related settings should be displayed or not. It differs from the flag UIComponent.CreateSpaces. @@ -26,39 +24,4 @@ export default class TchapUIFeature { */ public static activateClearCacheAndReloadAtVersion4 = true; - /** - * This flag controls whether to activate cross-signing and secure storage. It is not static because the MatrixClient - * needs to be initialized to access the config.json (where the flag is set) - */ - public static isCrossSigningAndSecureStorageActive = (): Boolean => { - //retrieve the feature flag from the config.json features flag section. - //beware SdkConfig does not like to be invoked before the MatrixClient is initialized - const isCrossSigningAndSecureStorageActive = - SdkConfig.get("features")["tchap_activate_cross_signing_and_secure_storage"]; - console.log( - ":tchap: tchap_activate_cross_signing_and_secure_storage from config.json: ", - isCrossSigningAndSecureStorageActive, - ); - return isCrossSigningAndSecureStorageActive; - }; - - /** - * This flag activates cross-signing and secure storage. But it also hides the xsss setup toast. - * needs to be initialized to access the config.json (where the flag is set) - */ - public static isCrossSigningSetupToastDisabled = (): Boolean => { - //retrieve the feature flag from the config.json features flag section. - //beware SdkConfig does not like to be invoked before the MatrixClient is initialized - const isCrossSigningSetupToastDisabled = SdkConfig.get("features")["tchap_disable_cross_signing_setup_toast"]; - console.log( - ":tchap: tchap_disable_cross_signing_setup_toast from config.json: ", - isCrossSigningSetupToastDisabled, - ); - return isCrossSigningSetupToastDisabled; - }; - - /** - * This flag controls whether to force incoming key legacy verification (usefull for older mobile device than android 2.6, ios 2.2.3) - */ - public static forceLegacyIncomingRoomKeyVerification = false; } diff --git a/src/tchap/util/TchapUrls.ts b/src/tchap/util/TchapUrls.ts index ce29b81063..316fe9eee4 100644 --- a/src/tchap/util/TchapUrls.ts +++ b/src/tchap/util/TchapUrls.ts @@ -2,6 +2,9 @@ export default class TchapUrls { //url to request the opening of a new domain on Tchap public static requestDomainUrl = "https://www.demarches-simplifiees.fr/commencer/utiliser-tchap"; + //shorcut to secure backup page https://tchap.gouv.fr/#/sauvegarde-automatique + public static secureBackupFragment = "sauvegarde-automatique"; + //tchap status page public static statusPage = "https://status.tchap.numerique.gouv.fr" diff --git a/src/tchap/util/TchapUserSettings.ts b/src/tchap/util/TchapUserSettings.ts index 71e49bdcdf..a432376bab 100644 --- a/src/tchap/util/TchapUserSettings.ts +++ b/src/tchap/util/TchapUserSettings.ts @@ -1,17 +1,11 @@ -import { SettingLevel } from "matrix-react-sdk/src/settings/SettingLevel"; -import SettingsStore from "matrix-react-sdk/src/settings/SettingsStore"; - -import TchapUIFeature from "./TchapUIFeature"; export default class TchapUserSettings { /** + * * Override User Settings */ public static override() { - if (!TchapUIFeature.isCrossSigningAndSecureStorageActive()) { - //hard code this option in to order to hide secure storage in the user info > sessions panel - console.log(":tchap: hardcode e2ee.manuallyVerifyAllSessions to true"); - SettingsStore.setValue("e2ee.manuallyVerifyAllSessions", null, SettingLevel.DEVICE, true); - } + + //override user settings here if needed } } diff --git a/src/tchap/util/TchapUtils.ts b/src/tchap/util/TchapUtils.ts index 63ee9f2c47..1b1b3cfc9a 100644 --- a/src/tchap/util/TchapUtils.ts +++ b/src/tchap/util/TchapUtils.ts @@ -141,6 +141,7 @@ export default class TchapUtils { }; /** + * @deprecated * Ask the homeserver is cross signing is supported (async) * @returns Promise is cross signing is supported by home server or false */