1
0
mirror of https://github.com/bitwarden/jslib synced 2026-01-10 04:23:38 +00:00

[bug] Add missing await to timeout logic

This commit is contained in:
addison
2021-11-16 09:59:01 -05:00
parent c2a6b96fa5
commit 3c2db1b91c

View File

@@ -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);
}
}
}