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

Add key storage toggle to Encryption settings #29113

Open
wants to merge 24 commits into
base: develop
Choose a base branch
from

Conversation

dbkr
Copy link
Member

@dbkr dbkr commented Jan 27, 2025

Requires matrix-org/matrix-js-sdk#4661

Checklist

  • Tests written for new code (and old code if feasible).
  • New or updated public/exported symbols have accurate TSDoc documentation.
  • Linter and other CI checks pass.
  • I have licensed the changes to Element by completing the Contributor License Agreement (CLA)

Copy link
Member

@florianduros florianduros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last missing part of this new tab! Few questions and remarks

Icon={ErrorIcon}
destructive={true}
title={_t("settings|encryption|delete_key_storage|title")}
className="mx_ResetIdentityPanel"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to rename the CSS class to something more generic. I'm not expecting the mx_ResetIdentityPanel class in the _ResetIdentityPanel.css to have an impact in another component

Comment on lines +104 to +110
if (keyBackupIsEnabled === undefined) {
content = <Spinner />;
} else {
switch (state) {
case "loading":
content = <InlineSpinner aria-label={_t("common|loading")} />;
break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we have two loading state, I'll be happy if we can keep one loading state

setupNewKey ? setState("set_recovery_key") : setState("change_recovery_key")
}
if (keyBackupIsEnabled === undefined) {
content = <Spinner />;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
content = <Spinner />;
content = <InlineSpinner aria-label={_t("common|loading")} />;

@@ -45,7 +51,8 @@ export type State =
| "set_recovery_key"
| "reset_identity_compromised"
| "reset_identity_forgot"
| "secrets_not_cached";
| "secrets_not_cached"
| "key_storage_delete";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing doc :)

import { useKeyStoragePanelViewModel } from "../../../viewmodels/settings/encryption/KeyStoragePanelViewModel";

interface Props {
onKeyStorageDisableClick: () => void;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing tsdoc

Comment on lines +14 to +18
// 'null' means no backup is active. 'undefined' means we're still loading.
isEnabled: boolean | undefined;
setEnabled: (enable: boolean) => void;
loading: boolean; // true if the state is still loading for the first time
busy: boolean; // true if the status is in the process of being changed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All this attributes needs tsdoc and not only comments


interface KeyStoragePanelState {
// 'null' means no backup is active. 'undefined' means we're still loading.
isEnabled: boolean | undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no null value despite the comment

await matrixClient.deleteAccountData("m.megolm_backup.v1");

// Delete the key information
const defaultKeyEvent = matrixClient.getAccountData("m.secret_storage.default_key");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Genuine question, should we not use matrixClient.secretStorage.getDefaultKeyId() instead?

@@ -111,4 +111,19 @@ test.describe("Encryption tab", () => {
// The user is prompted to reset their identity
await expect(dialog.getByText("Forgot your recovery key? You’ll need to reset your identity.")).toBeVisible();
});

test("should warn before turning off key storage", async ({ page, app, util }) => {
await verifySession(app, "new passphrase");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I opened #29214

Comment on lines +121 to +123
await expect(
page.getByRole("heading", { name: "Are you sure you want to turn off key storage and delete it?" }),
).toBeVisible();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a screenshot can be great here to avoid regression on the "Are you sure you want to turn off key storage and delete it?" panel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants