Fix service tokens not working after upgrade

This commit is contained in:
Daniel Hougaard
2024-02-22 23:06:55 +01:00
parent 387094aa27
commit acf8a54abb
2 changed files with 11 additions and 2 deletions
+3 -2
View File
@@ -33,11 +33,12 @@ export const assignWorkspaceKeysToMembers = ({ members, decryptKey, userPrivateK
type TCreateProjectKeyDTO = {
publicKey: string;
privateKey: string;
plainProjectKey?: string;
};
export const createProjectKey = ({ publicKey, privateKey }: TCreateProjectKeyDTO) => {
export const createProjectKey = ({ publicKey, privateKey, plainProjectKey }: TCreateProjectKeyDTO) => {
// 3. Create a random key that we'll use as the project key.
const randomBytes = crypto.randomBytes(16).toString("hex");
const randomBytes = plainProjectKey || crypto.randomBytes(16).toString("hex");
// 4. Encrypt the project key with the users key pair.
const { ciphertext: encryptedProjectKey, nonce: encryptedProjectKeyIv } = encryptAsymmetric(