evgenyneu / keychain-swift

Helper functions for saving text in Keychain securely for iOS, OS X, tvOS and watchOS.
MIT License
2.82k stars 345 forks source link

Feature request: Add getAll() and getAllKeys() #116

Closed AnthonyOliveri closed 5 years ago

AnthonyOliveri commented 5 years ago

There are two new methods for KeychainSwift that would be very useful to my iOS app:

  1. getAll(), which retrieves all key/value pairs stored in the keychain, returned as [String: Any]
  2. getAllKeys(), which does the same as getAll() but only retrieves the keys with return type [String]

I've already implemented these in my fork, and tried them out in my app where they work just fine. All I would need is to add documentation and another test or two, and then I could open a PR that adds these methods.

evgenyneu commented 5 years ago

Thanks for the proposal, @AnthonyOliveri. I don't want to add new features to this library (for the reason explained here). However, these two methods could be added if they are small. Could you share a link to the code in your fork or paste the code here?

AnthonyOliveri commented 5 years ago

Here they are: https://github.com/AnthonyOliveri/keychain-swift/commit/ab5b2e430e384d49d621b60748f96a7f69f48a51. I don't think the functionality for getting all keychain items is possible to do with the existing API, hence the new methods.

evgenyneu commented 5 years ago

@AnthonyOliveri thanks. Nah, I think this is too much code for our library. I want to keep it bare. I'm sure there are other libraries out there with this feature. Sorry. :)

AnthonyOliveri commented 5 years ago

I understand