-
-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use Keyring (unanswered questions) #706
Comments
Thanks for the questions! Happy to clarify and delighted you're interested in helping contribute to the documentation. Having been immersed in the project, I lack the perspective you can bring as a new user. I'll try to answer your questions (to your satisfaction) and hope you'll be willing to refine this into a narrative that will help others avoid the same confusion.
System is a generic term for the context where the username and password are relevant. It might be a computer's hostname, a URL, a service (like PyPI or NPM), or any other string to identify the context. For example, I store some MFA secrets using "{entity} MFA" as the system.
At a most basic level, it's a Python de facto standard for storing and retrieving secrets (passwords, tokens, etc.) securely in Python applications and on the command line utilizing platform-specific backends to be secure and somewhat interoperable with other systems. The most basic scenario really depends on your use-case. You might be coming to keyring because you learned that Assuming you are just seeking to save a password for use later, the usage is described in the readme. It describes how to set a password and retrieve that password using the keyring. For many users, that just works out of the box. It shows how to do that using the command line tool or the Python API. So imagine that you just created a password on a website and you want to save that to remember for later. You can do that with:
Then enter the password when prompted. Later, when you want to log into that web site again, retrieve the password with
The password will be emitted to the console. Just copy and paste it into your browser. If no password was set for the system+username combination, nothing will be emitted.
By default (without any plugins installed), keyring comes bundled with a few backends for storing and retrieving passwords (the ones you listed) and will automatically filter out ones that aren't available and then choose the highest priority of the ones that are. So if running the library on macOS, the macOS Keychain will be used. On Windows, the Windows Credential Locker will be used. On Linux, the Secret Service will be preferred over the KDE wallet, but if the Secret Service is unavailable and KDE is available, it will be used. Keyring also supports plugins to enable additional backends. If installed to the same Python environment as keyring is installed, keyring will activate those plugins, which may present additional backends at higher or lower priority. If the plugin-based backend is viable and resolves to a higher priority, it will be used. When multiple backends are viable and recommended (priority >= 1), they will all be consulted. Passwords will be set in the highest priority backend, but retrieved from any of the backends (in priority order).
To some extent, it sounds like you may need guidance from How is it you're using I hope that helps. Let me know if you have any more questions. |
Originally posted by @dd-ssc in #116
The text was updated successfully, but these errors were encountered: