In my application, logged-in users create some strings, and those strings are stored in the Postgres database.

But, because they are in plaintext, their values are visible to me, as I have access to the database.

Is there a way to do some encryption on a string, that won't be available to see the actual value in the database, but the only user who created it, should be able to seamlessly decrypt, and be able to use that actual string when they are logged in?

I know that for passwords we normally use hashing, but it can only be used to verify if the actual string matches the hashed string. However, in my case, the owner should be able to get the actual value that he/she originally stored (while making it impossible for me to get it from the database).

P.S: For authentication, I use JWT tokens, and user passwords are hashed using Bcrypt.

  • What you're referring to is an end to end encryption scheme. You can implement this by storing a secret exclusively on client-side that is used to encrypt and decrypt the string
    – belkarx
    May 18 at 0:11


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.