1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 18:23:31 +00:00

[Auto-Logout] Refactor LockService and Update Dependencies (#91)

* initial commit for lockService name refactor

* Reverted ConstantsService vault timeout key to legacy string value

Co-authored-by: Vincent Salucci <vsalucci@bitwarden.com>
This commit is contained in:
Vincent Salucci
2020-03-27 09:03:27 -05:00
committed by GitHub
parent 31a257407b
commit 64c54cfb86
11 changed files with 48 additions and 35 deletions

View File

@@ -19,10 +19,10 @@ import { Utils } from '../misc/utils';
import { EEFLongWordList } from '../misc/wordlist';
const Keys = {
key: 'key',
key: 'key', // Master Key
encOrgKeys: 'encOrgKeys',
encPrivateKey: 'encPrivateKey',
encKey: 'encKey',
encKey: 'encKey', // Generated Symmetric Key
keyHash: 'keyHash',
};
@@ -41,7 +41,7 @@ export class CryptoService implements CryptoServiceAbstraction {
async setKey(key: SymmetricCryptoKey): Promise<any> {
this.key = key;
const option = await this.storageService.get<number>(ConstantsService.lockOptionKey);
const option = await this.storageService.get<number>(ConstantsService.vaultTimeoutKey);
if (option != null) {
// if we have a lock option set, we do not store the key
return;
@@ -290,7 +290,7 @@ export class CryptoService implements CryptoServiceAbstraction {
async toggleKey(): Promise<any> {
const key = await this.getKey();
const option = await this.storageService.get(ConstantsService.lockOptionKey);
const option = await this.storageService.get(ConstantsService.vaultTimeoutKey);
if (option != null || option === 0) {
// if we have a lock option set, clear the key
await this.clearKey();