Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Idea: Add ability to search by username #112

Open
fbartho opened this issue Mar 7, 2018 · 9 comments
Open

Feature Idea: Add ability to search by username #112

fbartho opened this issue Mar 7, 2018 · 9 comments

Comments

@fbartho
Copy link

fbartho commented Mar 7, 2018

An app I'm working on stores a few bits of data as Generic Passwords under distinct usernames as persistent state (in native code) and I'm looking to migrate this app to react-native.

If we use react-native-keychain as implemented today, getGenericPassword doesn't take an option for kSecAttrAccount, so it returns 1 (random?) value from this list of 4 keys. It'd be great if we could submit the key we're looking to search for.

I'd be happy to contribute a PR for iOS, -- but I have no idea of the scope of this for Android. Would this PR be a welcome feature addition?

@ghost
Copy link

ghost commented Apr 30, 2018

We just encountered this issue after adding https://github.com/urbanairship/react-native-module (see urbanairship/react-native-airship#114 (comment)), would be very helpful to have this available.

@fbartho
Copy link
Author

fbartho commented May 1, 2018

@jacobcabantomski-ct -- My project is also going to need to use UrbanAirship so your referenced issue is going to be a blocker soon, so we're going to need this feature sooner than later. Do you want to collaborate on a PR for this?

I'd be happy to review your code if you have time this week, or I'd be happy to get it started in a week or so. -- Maybe @oblador might be able to fast-track it if we get it done well?

@ghost
Copy link

ghost commented May 1, 2018

@fbartho I'm currently awaiting feedback on whether we can invalidate current user logins and use getInternetCredentials to store our information in a more controllable way. If not, I'd be happy to collab on a PR. I have some rusty Android/Java skills I can contribute.

@fbartho
Copy link
Author

fbartho commented May 1, 2018

@jacobcabantomski-ct I'm pretty comfortable on the iOS side, myself, so with our powers combined…

From looking at what we'd need to do, I think the hardest part is the public API changes.

As I see it the easy options are:
A. we either ask for "all active generic passwords" and return an array of them which the user can filter down to 1
B. we update the options passed to getGenericPassword to have a username key that it can filter at the native level.

Depending on our implementation choice, it would actually mostly be javascript code. 1 small tweak to create a new api (getGenericPasswords) that returns an array, + add a shim in the JS to support the old API & return the first entry in this array if it exists.

@fbartho
Copy link
Author

fbartho commented May 1, 2018

Any opinions @oblador ? Which API would you prefer we add?

@veermangat
Copy link

I have the same issue, would be nice if we could pass the account to retrieve specific entries and not just the first one.

I am stuck, because I am trying to upgrade from a previous version of the app. And with this library I can only fetch the first value. If the user has had multiple accounts, there is no way to fetch the latest one currently.

@vomchik
Copy link

vomchik commented Sep 17, 2020

+1

1 similar comment
@krzysztofnowak
Copy link

+1

travis-mark added a commit to travis-mark/react-native-keychain that referenced this issue Jul 9, 2024
Maps to kSecAttrAccount on iOS
@travis-mark
Copy link

I just ran into this issue when reading keychain entries set by existing iOS code that used multiple accounts under the same service. PR: #643

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants