hiyaryan / the-cdj

The Cognitive Distortion Journal (CDJ) is a smart journaling tool that helps remedy distorted thinking. It can feel impossible to follow the CBT technique of labeling distorted thinking and finding alternative modes of thought (i.e. reframing) while cognitive distortions are occurring. The CDJ does that work for you. -- The CDJ is in beta testing!!
https://thecdj.app
3 stars 0 forks source link

Add encryption/decryption to config. #21

Closed hiyaryan closed 9 months ago

hiyaryan commented 9 months ago

This PR adds the necessity to store API keys in the database encrypted using AES. This requires an environment variable with a key to decrypt the API key on the server when it is retrieved by the authenticated user and when it is used for LLM access.

In addition to adding encryption, convenience methods have been added to the Config model of which encrypt and decrypt may be called on.

Finally, this PR adds pre middleware to all models that may be updated to update the updated_at date which until now has not been updated when data in the model has been updated.