-
-
Notifications
You must be signed in to change notification settings - Fork 63
Keyring Applications
This is an in-depth document about the three keyring applications. Each of the applications described here provides the ability to store and retrieve secrets from any keyring-compatible credential store. Both developers and users of keyring clients may find these applications useful, so this document is written for both. It’s meant to be read after the keyring overview document.
The Rust-based CLI serves several purposes:
- It provides a command-line interface for storing and retrieving secrets from keyring-compatible credential stores.
- It provides a code template for developers wishing to build applications that use the keyring facilities for managing secrets.
- It provides an inventory of keyring-compatible credential stores with examples of how to use each of them in a working application.
The CLI crate sources provide a library of utility functions and a command-line client application. Details of how to invoke the app are provided by the app itself if it is invoked with no arguments.
Users of keyring-based client applications may want to use the CLI to understand what data is being stored securely by their client application, or to remove that data completely once the client application is no longer available.
Developers who are developing keyring clients should read the source code of both the library and the application. It provides examples of how you connect to a credential store at application startup, how you use both the basic and advanced features of the keyring-core client API, and how you disconnect from a credential store at termination.
Developers who are developing keyring-compatible credential stores should prepare a PR for the keyring library that adds their store to those the library makes available. This will ensure that potential clients will know about their store and have a working example of how to connect to it properly.
The rust-native-keyring project on PyPI provides a Python module that can access Rust keyring credential stores.
Use
pip install rust-native-keyringto install the module and
import rust_native_keyringto load it into your Python REPL or application.
Here is a sample of what you can do:
import rust_native_keyring as rnk
rnk.use_named_store("sample", { 'backing-file': 'sample-test.ron' })
rnk.store_info()
entry = rnk.Entry('service', 'user')
entry.set_password('test password')
entry.info()
entry.get_credential().info()
if entry.get_password() == 'test password':
print('Passwords match!')
e2 = rnk.Entry('service', 'user2')
e2.set_password('test password 2')
entries = rnk.Entry.search({ 'service': 'service' })
print(list(map(lambda e: e.info(), entries)))
rnk.release_store()