Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Maintain the change introduced in #12059
Browse files Browse the repository at this point in the history
  • Loading branch information
BillCarsonFr committed Jan 3, 2024
1 parent 7d75553 commit 35806b5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/SecurityManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,11 @@ export async function withSecretStorageKeyCache<T>(func: () => Promise<T>): Prom
* @param {bool} [forceReset] Reset secret storage even if it's already set up
*/
export async function accessSecretStorage(func = async (): Promise<void> => {}, forceReset = false): Promise<void> {
secretStorageBeingAccessed = true;
await withSecretStorageKeyCache(() => doAccessSecretStorage(func, forceReset));
}

/** Helper for {@link #accessSecretStorage} */
export async function doAccessSecretStorage(func = async (): Promise<void> => {}, forceReset = false): Promise<void> {
try {
const cli = MatrixClientPeg.safeGet();
if (!(await cli.hasSecretStorageKey()) || forceReset) {
Expand Down Expand Up @@ -414,8 +418,6 @@ export async function accessSecretStorage(func = async (): Promise<void> => {},
logger.error(e);
// Re-throw so that higher level logic can abort as needed
throw e;
} finally {
secretStorageBeingAccessed = false;
}
}

Expand Down

0 comments on commit 35806b5

Please sign in to comment.