Update encryptSecrets.ts

This commit is contained in:
Daniel Hougaard
2024-06-21 15:21:52 +02:00
parent f3da676b88
commit 077cbc97d5
@@ -3,6 +3,7 @@ import crypto from "crypto";
import { SecretDataProps, Tag } from "public/data/frequentInterfaces"; import { SecretDataProps, Tag } from "public/data/frequentInterfaces";
import { fetchUserWsKey } from "@app/hooks/api/keys/queries"; import { fetchUserWsKey } from "@app/hooks/api/keys/queries";
import { SecretType } from "@app/hooks/api/types";
import { decryptAssymmetric, encryptSymmetric } from "../cryptography/crypto"; import { decryptAssymmetric, encryptSymmetric } from "../cryptography/crypto";
@@ -20,7 +21,7 @@ interface EncryptedSecretProps {
secretValueCiphertext: string; secretValueCiphertext: string;
secretValueIV: string; secretValueIV: string;
secretValueTag: string; secretValueTag: string;
type: "personal" | "shared"; type: SecretType;
tags: Tag[]; tags: Tag[];
} }
@@ -108,8 +109,8 @@ const encryptSecrets = async ({
secretCommentTag, secretCommentTag,
type: type:
secret.valueOverride === undefined || secret?.value !== secret?.valueOverride secret.valueOverride === undefined || secret?.value !== secret?.valueOverride
? "shared" ? SecretType.Shared
: "personal", : SecretType.Personal,
tags: secret.tags tags: secret.tags
}; };