1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 01:03:35 +00:00

update pin key when the user symmetric key is set

- always set the protected pin so we can recreate pin key from user symmetric key
- stop using EncryptionPair in account
- use EncString for both pin key storage
- update migration from old strategy on lock component
This commit is contained in:
Jacob Fink
2023-06-07 09:44:34 -04:00
parent 7837202180
commit 6fc7c406a4
14 changed files with 134 additions and 97 deletions

View File

@@ -9,16 +9,12 @@ describe("AccountSettings", () => {
it("should deserialize userSymKeyPin", () => {
const accountSettings = new AccountSettings();
accountSettings.userSymKeyPin = EncryptionPair.fromJSON<string, EncString>({
encrypted: "encrypted",
decrypted: "3.data",
});
accountSettings.userSymKeyPin = EncString.fromJSON("encrypted");
const jsonObj = JSON.parse(JSON.stringify(accountSettings));
const actual = AccountSettings.fromJSON(jsonObj);
expect(actual.userSymKeyPin).toBeInstanceOf(EncryptionPair);
expect(actual.userSymKeyPin.encrypted).toEqual("encrypted");
expect(actual.userSymKeyPin.decrypted.encryptedString).toEqual("3.data");
expect(actual.userSymKeyPin).toBeInstanceOf(EncString);
expect(actual.userSymKeyPin.encryptedString).toEqual("encrypted");
});
it("should deserialize pinProtected", () => {