Fix encryption logic (#4672)

Co-authored-by: Thomas Trompette <thomast@twenty.com>
This commit is contained in:
Thomas Trompette
2024-03-26 17:43:32 +01:00
committed by GitHub
parent d4eb75abff
commit f08dfec00a
3 changed files with 29 additions and 37 deletions

View File

@ -53,8 +53,6 @@ export class RemoteServerService<T extends RemoteServerType> {
const encryptedPassword = await encryptText(
remoteServerInput.userMappingOptions.password,
key,
// TODO: check if we should use a separated IV
key,
);
remoteServerToCreate = {

View File

@ -17,11 +17,7 @@ export const buildPostgresUrl = (
const foreignDataWrapperOptions = remoteServer.foreignDataWrapperOptions;
const userMappingOptions = remoteServer.userMappingOptions;
const password = decryptText(
userMappingOptions.password,
secretKey,
secretKey,
);
const password = decryptText(userMappingOptions.password, secretKey);
const url = `postgres://${userMappingOptions.username}:${password}@${foreignDataWrapperOptions.host}:${foreignDataWrapperOptions.port}/${foreignDataWrapperOptions.dbname}`;