1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-23 11:56:00 +01:00

Add support for extending VaultTimeoutService (#275)

This commit is contained in:
Oscar Hinton 2021-02-18 19:08:20 +01:00 committed by GitHub
parent fc1275aeb2
commit b0ae1bfa4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,7 +22,7 @@ export class VaultTimeoutService implements VaultTimeoutServiceAbstraction {
constructor(private cipherService: CipherService, private folderService: FolderService,
private collectionService: CollectionService, private cryptoService: CryptoService,
private platformUtilsService: PlatformUtilsService, private storageService: StorageService,
protected platformUtilsService: PlatformUtilsService, private storageService: StorageService,
private messagingService: MessagingService, private searchService: SearchService,
private userService: UserService, private tokenService: TokenService,
private lockedCallback: () => Promise<void> = null, private loggedOutCallback: () => Promise<void> = null) {
@ -35,11 +35,15 @@ export class VaultTimeoutService implements VaultTimeoutServiceAbstraction {
this.inited = true;
if (checkOnInterval) {
this.checkVaultTimeout();
setInterval(() => this.checkVaultTimeout(), 10 * 1000); // check every 10 seconds
this.startCheck();
}
}
startCheck() {
this.checkVaultTimeout();
setInterval(() => this.checkVaultTimeout(), 10 * 1000); // check every 10 seconds
}
// Keys aren't stored for a device that is locked or logged out.
async isLocked(): Promise<boolean> {
const hasKey = await this.cryptoService.hasKey();