mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 15:23:33 +00:00
memory stored pinProtectedKey
This commit is contained in:
2
jslib
2
jslib
Submodule jslib updated: 99d56d936f...b74ee7b3ee
@@ -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' });
|
||||
|
||||
Reference in New Issue
Block a user