hwchen / keyring-rs

Cross-platform library and utility to manage passwords
Apache License 2.0
450 stars 49 forks source link

Implementation of keyring-search #176

Open wiimmers opened 5 days ago

wiimmers commented 5 days ago

An implementation of keyring-search into the keyring crate.

So far efforts have been made for all platform specific modules. However, the mock module remains untouched. Some work has been done to attempt to get this to work using generics and now modified keyring-search MockCredentialStore. I am hoping for some collaboration in getting this to work.

The CLI example has been modified to show the functionality of the crate, with the ability to search and create entries from those search results.

The search function uses all three of the keyring-search by methods (by_user, by_target, by_service) and then filters duplicate results. This way clients need not specify extra parameters and simply pass a search query.

wiimmers commented 5 days ago

It is worth mentioning that linux-test.sh has also been modified to test the keyutils specific tests for the search feature.

The line: cargo test --features "linux-no-secret-service" --verbose has been added to handle this change. I would imagine that Cargo.toml could potentially be modified to alleviate the need for this but this was how I chose to handle the change for the time being.

brotskydotcom commented 1 day ago

Thanks so much for this contribution! I'm very busy right now working on a libdbus-based (fully synchronous) version of secret-service to go into a new major version (along with the newly-released async secret-service crate), and I'm hoping we can get this PR ready to go into that new release as well (which will allow us to make non-backwards-compatible changes to the API if necessary). Are there any such changes that you think you make this a better fit?