From 3c2db1b91c9113ad399eb2a87ea1314b59826752 Mon Sep 17 00:00:00 2001 From: addison Date: Tue, 16 Nov 2021 09:59:01 -0500 Subject: [PATCH] [bug] Add missing await to timeout logic --- common/src/services/vaultTimeout.service.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/src/services/vaultTimeout.service.ts b/common/src/services/vaultTimeout.service.ts index e665b102..30142fe5 100644 --- a/common/src/services/vaultTimeout.service.ts +++ b/common/src/services/vaultTimeout.service.ts @@ -47,7 +47,9 @@ export class VaultTimeoutService implements VaultTimeoutServiceAbstraction { const neverLock = await this.cryptoService.hasKeyStored(KeySuffixOptions.Auto, userId) && !(await this.stateService.getEverBeenUnlocked({ userId: userId })); if (neverLock) { - return (await this.cryptoService.getKey(KeySuffixOptions.Auto, userId)) != null; + // TODO: This also sets the key so when we check memory in the next line it finds a key. + // We should refactor here. + await this.cryptoService.getKey(KeySuffixOptions.Auto, userId); } return !(await this.cryptoService.hasKeyInMemory(userId)); @@ -60,7 +62,7 @@ export class VaultTimeoutService implements VaultTimeoutServiceAbstraction { for (const userId in this.stateService.accounts.getValue()) { if (userId != null && await this.shouldLock(userId)) { - this.executeTimeoutAction(userId); + await this.executeTimeoutAction(userId); } } }