Undo encstring test string change

This commit is contained in:
Bernd Schoolmann 2025-12-09 15:56:12 +01:00
parent 86d0576d74
commit 0b55462f59
No known key found for this signature in database

View File

@ -1,4 +1,13 @@
import { USER_EVER_HAD_USER_KEY } from "./user-key.state";
import { EncString } from "../../../key-management/crypto/models/enc-string";
import { EncryptionType } from "../../enums";
import { Utils } from "../../misc/utils";
import { USER_ENCRYPTED_PRIVATE_KEY, USER_EVER_HAD_USER_KEY } from "./user-key.state";
function makeEncString(data?: string) {
data ??= Utils.newGuid();
return new EncString(EncryptionType.AesCbc256_HmacSha256_B64, data, "test", "test");
}
describe("Ever had user key", () => {
const sut = USER_EVER_HAD_USER_KEY;
@ -11,3 +20,15 @@ describe("Ever had user key", () => {
expect(result).toEqual(everHadUserKey);
});
});
describe("Encrypted private key", () => {
const sut = USER_ENCRYPTED_PRIVATE_KEY;
it("should deserialize encrypted private key", () => {
const encryptedPrivateKey = makeEncString().encryptedString;
const result = sut.deserializer(JSON.parse(JSON.stringify(encryptedPrivateKey)));
expect(result).toEqual(encryptedPrivateKey);
});
});