mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-26 12:25:20 +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> {
|
async hasKeyStored(keySuffix: KeySuffixOptions, userId?: string): Promise<boolean> {
|
||||||
const key =
|
switch (keySuffix) {
|
||||||
keySuffix === KeySuffixOptions.Auto
|
case KeySuffixOptions.Auto:
|
||||||
? await this.stateService.getCryptoMasterKeyAuto({ userId: userId })
|
return (await this.stateService.getCryptoMasterKeyAuto({ userId: userId })) != null;
|
||||||
: await this.stateService.hasCryptoMasterKeyBiometric({ userId: userId });
|
case KeySuffixOptions.Biometric:
|
||||||
|
return (await this.stateService.hasCryptoMasterKeyBiometric({ userId: userId })) === true;
|
||||||
return key != null;
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async hasEncKey(): Promise<boolean> {
|
async hasEncKey(): Promise<boolean> {
|
||||||
|
Loading…
Reference in New Issue
Block a user