mirror of
https://github.com/bitwarden/browser
synced 2025-12-20 02:03:39 +00:00
support for unlocking with PIN code
This commit is contained in:
@@ -266,6 +266,10 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
return this.storageService.remove(Keys.encOrgKeys);
|
||||
}
|
||||
|
||||
clearPinProtectedKey(): Promise<any> {
|
||||
return this.storageService.remove(ConstantsService.pinProtectedKey);
|
||||
}
|
||||
|
||||
clearKeys(): Promise<any> {
|
||||
return Promise.all([
|
||||
this.clearKey(),
|
||||
@@ -273,6 +277,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
this.clearOrgKeys(),
|
||||
this.clearEncKey(),
|
||||
this.clearKeyPair(),
|
||||
this.clearPinProtectedKey(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -319,6 +324,11 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
return [publicB64, privateEnc];
|
||||
}
|
||||
|
||||
async makePinKey(pin: string, salt: string): Promise<SymmetricCryptoKey> {
|
||||
const pinKey = await this.makeKey(pin, salt, KdfType.PBKDF2_SHA256, 100000);
|
||||
return await this.stretchKey(pinKey);
|
||||
}
|
||||
|
||||
async hashPassword(password: string, key: SymmetricCryptoKey): Promise<string> {
|
||||
if (key == null) {
|
||||
key = await this.getKey();
|
||||
|
||||
Reference in New Issue
Block a user