mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-06 09:20:43 +01:00
Resolve hasKeyStored returning true when no biometric key is stored (#671)
* Resolve hasKeyStored returning true when no biometric key is stored * Change to use a switch statement which avoids having to fetch the key. * Use triple equals * Run prettier
This commit is contained in:
parent
b0f735814f
commit
fd0410ca4b
@ -347,12 +347,14 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
}
|
||||
|
||||
async hasKeyStored(keySuffix: KeySuffixOptions, userId?: string): Promise<boolean> {
|
||||
const key =
|
||||
keySuffix === KeySuffixOptions.Auto
|
||||
? await this.stateService.getCryptoMasterKeyAuto({ userId: userId })
|
||||
: await this.stateService.hasCryptoMasterKeyBiometric({ userId: userId });
|
||||
|
||||
return key != null;
|
||||
switch (keySuffix) {
|
||||
case KeySuffixOptions.Auto:
|
||||
return (await this.stateService.getCryptoMasterKeyAuto({ userId: userId })) != null;
|
||||
case KeySuffixOptions.Biometric:
|
||||
return (await this.stateService.hasCryptoMasterKeyBiometric({ userId: userId })) === true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async hasEncKey(): Promise<boolean> {
|
||||
|
Loading…
Reference in New Issue
Block a user