How do you manage keys and tokens, seasoned Pythonistas?
I thought it was said that saving keys as environment variables was a bad idea? I normally use a.env file and load values from it with dotenv, and I make sure to include it in my gitignore file.
However, after reading that it is bad practise to maintain keys and sensitive information as environment variables (temporary or otherwise), I'm curious as to what constitutes good security practise.
@nami_22 Pythonista provides the keychain module
The keychain module provides simple access to secure password storage.
Please note that the keychain is not shared between apps, so you (fortunately) cannot use this to access passwords that are stored in Safari’s keychain, for example.
Get the password for the given service/account that was previously stored in the keychain.
keychain.set_password(service, account, password)
Save a password for the given service/account in the keychain.
Delete the password for the given service/account from the keychain.
Delete all data from the keychain.