Postgres PGP_SYM_DECRYPT and PGP_SYM_ENCRYPT where search with Sequelize #16570
Unanswered
TrofinSorin
asked this question in
Help & Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a question about PGP_SYM_DECRYPT and PGP_SYM_ENCRYPT with Sequelize. I have the Encrypted data in the Database, but when I want to search by key I cannot find it because the key is not encrypted back when sent from where clause.
return await database.Example.findOne({ attributes: { include: [ [Sequelize.fn('PGP_SYM_DECRYPT', Sequelize.cast(Sequelize.col('value'), 'bytea'), process.env.AES_ENCRYPTION_KEY), 'value'], [Sequelize.fn('PGP_SYM_DECRYPT', Sequelize.cast(Sequelize.col('key'), 'bytea'), process.env.AES_ENCRYPTION_KEY), 'key'], ] }, where: { key, user_id: id } });
PGP_SYM_ENCRYPT in where clause doesn't work for me, any thoughts? Thank you
where: { key: Sequelize.fn('PGP_SYM_ENCRYPT', key, process.env.AES_ENCRYPTION_KEY), user_id: id }
Beta Was this translation helpful? Give feedback.
All reactions