1
0
mirror of https://github.com/bitwarden/jslib synced 2025-12-13 23:03:33 +00:00

Use 2 iterations for local password hashing (#404)

* Use 2 iterations for local password hashing

* fix typo
This commit is contained in:
Thomas Rittson
2021-06-09 14:24:31 -07:00
committed by GitHub
parent 5ba1416679
commit 8797924bd1
8 changed files with 51 additions and 23 deletions

View File

@@ -22,6 +22,7 @@ import { SetPasswordRequest } from 'jslib-common/models/request/setPasswordReque
import { ChangePasswordComponent as BaseChangePasswordComponent } from './change-password.component';
import { HashPurpose } from 'jslib-common/enums/hashPurpose';
import { KdfType } from 'jslib-common/enums/kdfType';
@Directive()
@@ -86,10 +87,13 @@ export class SetPasswordComponent extends BaseChangePasswordComponent {
await this.userService.setInformation(await this.userService.getUserId(), await this.userService.getEmail(),
this.kdf, this.kdfIterations);
await this.cryptoService.setKey(key);
await this.cryptoService.setKeyHash(masterPasswordHash);
await this.cryptoService.setEncKey(encKey[1].encryptedString);
await this.cryptoService.setEncPrivateKey(keys[1].encryptedString);
const localKeyHash = await this.cryptoService.hashPassword(this.masterPassword, key,
HashPurpose.LocalAuthorization);
await this.cryptoService.setKeyHash(localKeyHash);
if (this.onSuccessfulChangePassword != null) {
this.onSuccessfulChangePassword();
} else {