Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
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.
keychain.get_password(service, account)
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.keychain.delete_password(service, account)
Delete the password for the given service/account from the keychain.keychain.reset_keychain()
Delete all data from the keychain.