|
|
|
|
@ -18,7 +18,6 @@ export class VaultTimeoutService implements VaultTimeoutServiceAbstraction {
@@ -18,7 +18,6 @@ export class VaultTimeoutService implements VaultTimeoutServiceAbstraction {
|
|
|
|
|
pinProtectedKey: EncString = null; |
|
|
|
|
biometricLocked: boolean = true; |
|
|
|
|
everBeenUnlocked: boolean = false; |
|
|
|
|
manuallyOrTimerLocked: boolean = false; |
|
|
|
|
|
|
|
|
|
private inited = false; |
|
|
|
|
|
|
|
|
|
@ -48,17 +47,12 @@ export class VaultTimeoutService implements VaultTimeoutServiceAbstraction {
@@ -48,17 +47,12 @@ export class VaultTimeoutService implements VaultTimeoutServiceAbstraction {
|
|
|
|
|
|
|
|
|
|
// Keys aren't stored for a device that is locked or logged out.
|
|
|
|
|
async isLocked(): Promise<boolean> { |
|
|
|
|
// Handle never lock startup situation
|
|
|
|
|
if (await this.cryptoService.hasKeyStored('auto') && !this.everBeenUnlocked) { |
|
|
|
|
await this.cryptoService.getKey('auto'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const hasKey = await this.cryptoService.hasKey(); |
|
|
|
|
if (hasKey) { |
|
|
|
|
if ((await this.isBiometricLockSet() && this.biometricLocked) || this.manuallyOrTimerLocked) { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return !hasKey; |
|
|
|
|
return !this.cryptoService.hasKeyInMemory(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async checkVaultTimeout(): Promise<void> { |
|
|
|
|
@ -108,7 +102,7 @@ export class VaultTimeoutService implements VaultTimeoutServiceAbstraction {
@@ -108,7 +102,7 @@ export class VaultTimeoutService implements VaultTimeoutServiceAbstraction {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.biometricLocked = true; |
|
|
|
|
this.manuallyOrTimerLocked = true; |
|
|
|
|
this.everBeenUnlocked = true; |
|
|
|
|
await this.cryptoService.clearKey(false); |
|
|
|
|
await this.cryptoService.clearOrgKeys(true); |
|
|
|
|
await this.cryptoService.clearKeyPair(true); |
|
|
|
|
@ -149,7 +143,6 @@ export class VaultTimeoutService implements VaultTimeoutServiceAbstraction {
@@ -149,7 +143,6 @@ export class VaultTimeoutService implements VaultTimeoutServiceAbstraction {
|
|
|
|
|
|
|
|
|
|
clear(): Promise<any> { |
|
|
|
|
this.everBeenUnlocked = false; |
|
|
|
|
this.manuallyOrTimerLocked = false; |
|
|
|
|
this.pinProtectedKey = null; |
|
|
|
|
return this.storageService.remove(ConstantsService.protectedPin); |
|
|
|
|
} |
|
|
|
|
|