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 #29310

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

Conversation

dbkr
Copy link
Member

@dbkr dbkr commented Feb 18, 2025

#29113 minus a couple of things that got split out

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)

as apparenty the error icon has changed
@dbkr
Copy link
Member Author

dbkr commented Feb 27, 2025

Right, I think this is finally ready for another look.

@dbkr dbkr marked this pull request as ready for review February 27, 2025 17:16
@dbkr dbkr requested review from a team as code owners February 27, 2025 17:16
Comment on lines 149 to 150
* we don't so much care about the value of the account data, "m.org.matrix.custom.backup_disabled"
* flag here: what's important is whether key backup is actually happening or not).
Copy link
Member

Choose a reason for hiding this comment

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

ok, but this does not match what the code is doing. So: what gives?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've added some more clarification: I couldn't see a better way to do this although happy to change it if you have a suggestion.

Copy link
Member

@richvdh richvdh Feb 28, 2025

Choose a reason for hiding this comment

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

my point is: we're not checking whether key backup is actually happening or not. For better or worse, that's not what getKeyBackupInfo does.

In any case: are you sure that "whether the key backup is actually happening" is the intended design, from product/design folks?

Comment on lines +73 to +75
if (currentKeyBackup === null) {
await crypto.resetKeyBackup();
}
Copy link
Member

Choose a reason for hiding this comment

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

could you explain why this is necessary, and why only when currentKeyBackup is null?

Comment on lines +94 to +114
// also turn off 4S, since this is also storing keys on the server.
// Delete the cross signing keys from secret storage
await matrixClient.deleteAccountData("m.cross_signing.master");
await matrixClient.deleteAccountData("m.cross_signing.self_signing");
await matrixClient.deleteAccountData("m.cross_signing.user_signing");
// and the key backup key (we just turned it off anyway)
await matrixClient.deleteAccountData("m.megolm_backup.v1");

// Delete the key information
const defaultKey = await matrixClient.secretStorage.getDefaultKeyId();
if (defaultKey) {
await matrixClient.deleteAccountData(`m.secret_storage.key.${defaultKey}`);

// ...and the default key pointer
await matrixClient.deleteAccountData("m.secret_storage.default_key");
}

// finally, set a flag to say that the user doesn't want key backup.
// Element X uses this to determine whether to set up automatically,
// so this will stop EX turning it back on spontaneously.
await matrixClient.setAccountData("m.org.matrix.custom.backup_disabled", { disabled: true });
Copy link
Member

Choose a reason for hiding this comment

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

didn't we talk about disabling dehydration, and making this all a method in the js-sdk?

}

/**
* Confirms that the user really wants to turn off and delete their key storage
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
* Confirms that the user really wants to turn off and delete their key storage
* Confirms that the user really wants to turn off and delete their key storage. Part of the "Encryption" settings tab.

@@ -3529,7 +3529,7 @@
classnames "^2.5.1"
vaul "^1.0.0"

"@vector-im/matrix-wysiwyg-wasm@link:../../Library/Caches/Yarn/v6/npm-@vector-im-matrix-wysiwyg-2.38.0-af862ffd231dc0a6b8d6f2cb3601e68456c0ff24-integrity/node_modules/bindings/wysiwyg-wasm":
"@vector-im/matrix-wysiwyg-wasm@link:../../../.cache/yarn/v6/npm-@vector-im-matrix-wysiwyg-2.38.0-af862ffd231dc0a6b8d6f2cb3601e68456c0ff24-integrity/node_modules/bindings/wysiwyg-wasm":
Copy link
Member

Choose a reason for hiding this comment

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

I don't know if this makes any difference, but it should probably be removed from this PR to reduce the risk of conflicts

Copy link
Member

Choose a reason for hiding this comment

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

I really don't feel like this snapshot should be changing, but I guess it's fine

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.

3 participants