1
0
mirror of https://github.com/bitwarden/jslib synced 2025-12-27 21:53:14 +00:00

[bug] Only get key hash from storage

This commit is contained in:
addison
2021-11-12 12:34:02 -05:00
parent 2d124d6883
commit ca34576d8d

View File

@@ -4,7 +4,6 @@ import { EncryptionType } from '../enums/encryptionType';
import { HashPurpose } from '../enums/hashPurpose';
import { KdfType } from '../enums/kdfType';
import { KeySuffixOptions } from '../enums/keySuffixOptions';
import { StorageLocation } from '../enums/storageLocation';
import { EncArrayBuffer } from '../models/domain/encArrayBuffer';
import { EncryptedObject } from '../models/domain/encryptedObject';
@@ -121,16 +120,7 @@ export class CryptoService implements CryptoServiceAbstraction {
}
async getKeyHash(): Promise<string> {
let keyHash = await this.stateService.getKeyHash({ storageLocation: StorageLocation.Memory });
if (keyHash != null) {
return keyHash;
}
keyHash = await this.stateService.getKeyHash({ storageLocation: StorageLocation.Disk });
if (keyHash != null) {
await this.stateService.setKeyHash(keyHash, { storageLocation: StorageLocation.Memory });
}
return keyHash;
return await this.stateService.getKeyHash();
}
async compareAndUpdateKeyHash(masterPassword: string, key: SymmetricCryptoKey): Promise<boolean> {