mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-27 12:36:14 +01:00
memory stored pinProtectedKey
This commit is contained in:
parent
8ebed21017
commit
a519ed2580
2
jslib
2
jslib
@ -1 +1 @@
|
||||
Subproject commit 99d56d936fdebc99994ce5089e8f063729a2e0ec
|
||||
Subproject commit b74ee7b3ee823a820854623cc32c8522a09e9f4d
|
@ -149,16 +149,17 @@ export class SettingsComponent implements OnInit {
|
||||
masterPassOnRestart = (document.getElementById('master-pass-restart') as HTMLInputElement).checked;
|
||||
}
|
||||
if (pin != null && pin.trim() !== '') {
|
||||
const kdf = await this.userService.getKdf();
|
||||
const kdfIterations = await this.userService.getKdfIterations();
|
||||
const email = await this.userService.getEmail();
|
||||
const pinKey = await this.cryptoService.makePinKey(pin, email, kdf, kdfIterations);
|
||||
const key = await this.cryptoService.getKey();
|
||||
const pinProtectedKey = await this.cryptoService.encrypt(key.key, pinKey);
|
||||
if (masterPassOnRestart) {
|
||||
const encPin = await this.cryptoService.encrypt(pin);
|
||||
await this.storageService.save(ConstantsService.protectedPin, encPin.encryptedString);
|
||||
this.lockService.pinProtectedKey = pinProtectedKey;
|
||||
} else {
|
||||
const kdf = await this.userService.getKdf();
|
||||
const kdfIterations = await this.userService.getKdfIterations();
|
||||
const email = await this.userService.getEmail();
|
||||
const pinKey = await this.cryptoService.makePinKey(pin, email, kdf, kdfIterations);
|
||||
const key = await this.cryptoService.getKey();
|
||||
const pinProtectedKey = await this.cryptoService.encrypt(key.key, pinKey);
|
||||
await this.storageService.save(ConstantsService.pinProtectedKey, pinProtectedKey.encryptedString);
|
||||
}
|
||||
} else {
|
||||
@ -166,8 +167,8 @@ export class SettingsComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
if (!this.pin) {
|
||||
await this.storageService.remove(ConstantsService.pinProtectedKey);
|
||||
await this.storageService.remove(ConstantsService.protectedPin);
|
||||
await this.cryptoService.clearPinProtectedKey();
|
||||
await this.lockService.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,6 @@ export class AppComponent implements OnInit {
|
||||
this.stateService.purge(),
|
||||
]);
|
||||
|
||||
this.lockService.pinLocked = false;
|
||||
this.searchService.clearIndex();
|
||||
this.authService.logOut(async () => {
|
||||
this.analytics.eventTrack.next({ action: 'Logged Out' });
|
||||
|
Loading…
Reference in New Issue
Block a user