Answer the question
In order to leave comments, you need to log in
How to encrypt to a string using bcrypt?
There is a frontend on the angular, there is a backend on the node.
I need to encrypt a json object using bcrypt, for further saving it in local storage, then when I need it, I need to decrypt it on the front.
How can I use bcrypt to encrypt data into a string that can then be decrypted with the secret?
And where do I keep secrets safely?
Answer the question
In order to leave comments, you need to log in
Bcrypt is not suitable, encryption is one-way, i.e. the original data from the encrypted cannot be obtained.
There is a library with many popular encryption algorithms, you can use, for example, AES
https://github.com/brix/crypto-js
It also seems to work under the browser (not tested)
Where to store is a matter of application logic. If it is assumed that user data is stored on the server in encrypted form, then it is better not to store secrets anywhere, but to ask the user at the time of decryption on the client.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question