hwchen / keyring-rs

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

Add ability to access named keychains in macOS. #44

Closed nagasunilt closed 2 years ago

nagasunilt commented 4 years ago

Current macOS implementation uses the default keychain by default and does not support opening specific keychain. This limits our ability to open system keychain since default keychain is almost always login keychain on macOS. What is the best possible to add this support to current implementation? I made this PR but open to any better implementation if there is one.

Ideally looking for functionality similar to https://developer.apple.com/documentation/security/1396431-seckeychainopen and https://github.com/kornelski/rust-security-framework/blob/master/security-framework/src/os/macos/keychain.rs#L36

hwchen commented 4 years ago

Thanks for making the PR. I think that the functionality looks fine, I'm just a bit wary because I haven't created any guardrails in terms of keeping the interface consistent across each OS.

I created this when I was newer at Rust, so I didn't really think about having a trait Keyring that each OS would implement, with extension traits specific to each OS. I guess I'm just not sure whether that would be that helpful here, though, since the library is pretty simple.

Perhaps I'll ask in one of the rust forums. And let me know if you have any feedback on this.

hwchen commented 4 years ago

I asked the question here: https://users.rust-lang.org/t/trait-necessary-for-cross-platform-interface/44581

hwchen commented 4 years ago

Just want to ping some recent contributors about this. Having a Keyring trait would be a breaking change.

@MaikKlein @moritzheiber @bhkaminski

nagasunilt commented 4 years ago

@hwchen any update on how you want to move forward on this?

hwchen commented 4 years ago

I think I will just add this functionality as you’ve implemented in your pull request, and then think about using traits for a new major version. Hopefully I’ll get to it this weekend.

nagasunilt commented 4 years ago

gentle bump!

adobeDan commented 2 years ago

Hi @nagasunilt , we are revamping platform support for keyring and have not lost track of this issue. Both Mac and Linux support multiple named keychains (although Mac has now deprecated using file-based keychains so only the OS ones are available). We will look at how to support opening other than the default keychain on all platforms. Thanks!

brotskydotcom commented 2 years ago

closed with merge of #70