hwchen / keyring-rs

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

Entry listing and searching #144

Closed soywod closed 3 months ago

soywod commented 1 year ago

First of all, thank you for this great crate!

Context

I am working on Pimalaya, a project that tries to improve open-source tools related to Personal Information Management. I try to design a lib built at the top of you keyring crate that would be a bit higher level (including caching with keyutils, prompt for passwords etc). I also plan to develop a CLI at top of my lib.

Issue

Your crate seems to be focused on Entry, which means you expose a get set and delete. But for the CLI I also need to list and search entries, is it sth you plan to expose as well? I can propose a draft if you are interested in.

brotskydotcom commented 1 year ago

Hi Clément. This is an intriguing idea. Are you proposing to build search support into all of the underlying keystore implementations so that you can surface some sort of entry search? I would certainly be interested in seeing a PR for that!

soywod commented 1 year ago

Are you proposing to build search support into all of the underlying keystore implementations so that you can surface some sort of entry search?

It does not mean to be complicated, just string matching could be enough. The list is more important, as it allows lib consumers to build their own search. My point was more to know if it fits your crate scope? If so then I can propose a PR for listing, then let's see for the search.

brotskydotcom commented 1 year ago

Sorry for the late reply. I'd be very interested in seeing a PR that covers a listing in all platforms. I have consistently resisted the idea of adding any feature that only works on some platforms.

soywod commented 1 year ago

I'd be very interested in seeing a PR that covers a listing in all platforms.

Alright then, I come back to you whenever I have something. It may be in few weeks, maybe months.

Buckram123 commented 8 months ago

I'd be very interested in seeing a PR that covers a listing in all platforms. Alright then, I come back to you whenever I have something. It may be in few weeks, maybe months.

Is there any progress to this? I would really want to use it!

soywod commented 8 months ago

Is there any progress to this? I would really want to use it!

I had no occasion to work on this yet, plans slightly changed from my side. I still keep the feature in mind If I find the time one day!

wiimmers commented 5 months ago

I was also interested in this for a sort of passwordless login code format I had for an API of mine. I just wanted to check if the credential made by the app to store the login code existed. I have a working version to list target names in Windows, but want to make sure that's the goal of this before I try to make it work on other platforms. It's just a vector of strings that can be iterated to match a target name given by the client.

brotskydotcom commented 5 months ago

It doesn't sound like you need any new features in the crate in order to do what you want. If you can iterate the possible credential names, then you can use the crate to check if a credential with that name exists, and get its password.

wiimmers commented 5 months ago

Yes! I implemented, into the crate, a function called targets into the Entry struct. Then pointed to a default credential retriever function outside of the struct that points to the platform specific modules credential retriever (in my case, only Windows so far) and returns a list of all the targets in the store. I could be mistaken, but is this the feature looking to be added? Or is it a list of the whole entry; target, password, etc. and then a search function that we want? Thanks 👍🏻

brotskydotcom commented 5 months ago

I think the feature that @soywod proposed was meant to be more of a general search feature, where one might (for example) be able to iterate over all entries currently in the store. There is no one currently working on this, as far as I know.

wiimmers commented 5 months ago

Search feature #169 I've started a pull request for this feature, details can be found in the PR.

wiimmers commented 4 months ago

keyring-search a separate library for broad keystore searching. #169 still under development but will need some tweaks to fit with the functionality of the rest of the crate.

wiimmers commented 4 months ago

keyring-search is on crates.io now, v0.1.0. Should be fully functional aside from BSD implementations. Going to spend the rest of this week buttoning up the documentation and polishing this up.

brotskydotcom commented 4 months ago

I have closed #169 now that @wiimmers has released keyring-search. If he has the time, we will create some code in this crate for search for keyring-created credentials. But until then I recommend that people use the new crate for their searches.

brotskydotcom commented 3 months ago

Closing this issue now that keyring-search is available on crates.io.