Button to reset cross-signing and SSSS keys

This commit is contained in:
Zoe 2020-02-07 14:55:01 +00:00
parent 73b177d075
commit 8fdae73e03
5 changed files with 104 additions and 8 deletions

View file

@ -116,17 +116,20 @@ export const crossSigningCallbacks = {
* @param {Function} [func] An operation to perform once secret storage has been
* bootstrapped. Optional.
*/
export async function accessSecretStorage(func = async () => { }) {
export async function accessSecretStorage(func = async () => { }, force = false) {
const cli = MatrixClientPeg.get();
secretStorageBeingAccessed = true;
try {
if (!await cli.hasSecretStorageKey()) {
if (!await cli.hasSecretStorageKey() || force) {
console.warn(!force ? "!hasSecretStorageKey()" : "force");
// This dialog calls bootstrap itself after guiding the user through
// passphrase creation.
const { finished } = Modal.createTrackedDialogAsync('Create Secret Storage dialog', '',
import("./async-components/views/dialogs/secretstorage/CreateSecretStorageDialog"),
null, null, /* priority = */ false, /* static = */ true,
{
force,
},
null, /* priority = */ false, /* static = */ true,
);
const [confirmed] = await finished;
if (!confirmed) {