mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-09 19:28:06 +01:00
update pinLockType states and add jsdocs
This commit is contained in:
parent
32867e9207
commit
12d439ff9f
@ -157,13 +157,13 @@ export class LockComponent implements OnInit, OnDestroy {
|
|||||||
let userKeyPin: EncString;
|
let userKeyPin: EncString;
|
||||||
let oldPinProtected: EncString;
|
let oldPinProtected: EncString;
|
||||||
switch (this.pinStatus) {
|
switch (this.pinStatus) {
|
||||||
case "ENABLED": {
|
case "PERSISTANT": {
|
||||||
userKeyPin = await this.stateService.getUserKeyPin();
|
userKeyPin = await this.stateService.getUserKeyPin();
|
||||||
const oldEncryptedKey = await this.stateService.getEncryptedPinProtected();
|
const oldEncryptedKey = await this.stateService.getEncryptedPinProtected();
|
||||||
oldPinProtected = oldEncryptedKey ? new EncString(oldEncryptedKey) : undefined;
|
oldPinProtected = oldEncryptedKey ? new EncString(oldEncryptedKey) : undefined;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "ENABLED_WITH_MP_ON_RESET": {
|
case "TRANSIENT": {
|
||||||
userKeyPin = await this.stateService.getUserKeyPinEphemeral();
|
userKeyPin = await this.stateService.getUserKeyPinEphemeral();
|
||||||
oldPinProtected = await this.stateService.getDecryptedPinProtected();
|
oldPinProtected = await this.stateService.getDecryptedPinProtected();
|
||||||
break;
|
break;
|
||||||
@ -334,8 +334,7 @@ export class LockComponent implements OnInit, OnDestroy {
|
|||||||
let ephemeralPinSet = await this.stateService.getUserKeyPinEphemeral();
|
let ephemeralPinSet = await this.stateService.getUserKeyPinEphemeral();
|
||||||
ephemeralPinSet ||= await this.stateService.getDecryptedPinProtected();
|
ephemeralPinSet ||= await this.stateService.getDecryptedPinProtected();
|
||||||
this.pinEnabled =
|
this.pinEnabled =
|
||||||
(this.pinStatus === "ENABLED_WITH_MP_ON_RESET" && !!ephemeralPinSet) ||
|
(this.pinStatus === "TRANSIENT" && !!ephemeralPinSet) || this.pinStatus === "PERSISTANT";
|
||||||
this.pinStatus === "ENABLED";
|
|
||||||
|
|
||||||
this.supportsBiometric = await this.platformUtilsService.supportsBiometric();
|
this.supportsBiometric = await this.platformUtilsService.supportsBiometric();
|
||||||
this.biometricLock =
|
this.biometricLock =
|
||||||
|
@ -7,7 +7,12 @@ import { VaultTimeoutAction } from "../../enums/vault-timeout-action.enum";
|
|||||||
import { CryptoService } from "../../platform/abstractions/crypto.service";
|
import { CryptoService } from "../../platform/abstractions/crypto.service";
|
||||||
import { StateService } from "../../platform/abstractions/state.service";
|
import { StateService } from "../../platform/abstractions/state.service";
|
||||||
|
|
||||||
export type PinLockType = "DISABLED" | "ENABLED" | "ENABLED_WITH_MP_ON_RESET";
|
/**
|
||||||
|
* - DISABLED: No Pin set
|
||||||
|
* - PERSISTENT: Pin is set and survives client reset
|
||||||
|
* - TRANSIENT: Pin is set and requires password unlock after client reset
|
||||||
|
*/
|
||||||
|
export type PinLockType = "DISABLED" | "PERSISTANT" | "TRANSIENT";
|
||||||
|
|
||||||
export class VaultTimeoutSettingsService implements VaultTimeoutSettingsServiceAbstraction {
|
export class VaultTimeoutSettingsService implements VaultTimeoutSettingsServiceAbstraction {
|
||||||
constructor(
|
constructor(
|
||||||
@ -55,9 +60,9 @@ export class VaultTimeoutSettingsService implements VaultTimeoutSettingsServiceA
|
|||||||
const anOldUserKeyPinIsSet = !!(await this.stateService.getEncryptedPinProtected());
|
const anOldUserKeyPinIsSet = !!(await this.stateService.getEncryptedPinProtected());
|
||||||
|
|
||||||
if (aUserKeyPinIsSet || anOldUserKeyPinIsSet) {
|
if (aUserKeyPinIsSet || anOldUserKeyPinIsSet) {
|
||||||
return "ENABLED";
|
return "PERSISTANT";
|
||||||
} else if (pinIsEnabled && !aUserKeyPinIsSet && !anOldUserKeyPinIsSet) {
|
} else if (pinIsEnabled && !aUserKeyPinIsSet && !anOldUserKeyPinIsSet) {
|
||||||
return "ENABLED_WITH_MP_ON_RESET";
|
return "TRANSIENT";
|
||||||
} else {
|
} else {
|
||||||
return "DISABLED";
|
return "DISABLED";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user