What's the best way to go about encrypting data for my Flask app?
I am running a simple Flask app where I'm planning to add some more functionality soon. I will be using the Flask Mail extension where I need to use some email passwords to get it working. I see some people suggest adding secret keys in environment variables, others say this is not a safe way. Any advice?
Hey there! I can't say I'm a Flask aficionado either, so I had a bit of digging to do in order to put together what I think should be a good starting point. I'll go ahead and list the resources I utilized at below, starting with what I found to be the most helpful:
- Password Hashing with Flask Tutorial
- The Flask Mega-Tutorial Part X: Email Support
- Encrypting Your Data
- How to keep mail password safe while using flask mail
From what I've gathered, you can hash your users' passwords before storing them in your database, process requests against tokens, store keys either as environment variables or locally, or any combination of these methods.