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

Is not possible to have multiple accessControl for different usernames. #644

Open
MFrat opened this issue Jul 10, 2024 · 3 comments
Open

Comments

@MFrat
Copy link

MFrat commented Jul 10, 2024

Basically I want to store multiple data (more precisely 3: accessToken, refreshToken, local storage encryption) in keychain and I'm achieving it by using different service names for each (username, password). Although I think this is very weird and non-intuitive, since in native ios and android libraries we can set different (username,password) without overwriting old ones, but ok.

The problem is: I want to have a different accessControl for one specific username. But I simply can't because when I set it for one username it also set for all other usernames. Is it possible to overcome this with this library?

@DorianMazur
Copy link
Collaborator

Hi @MFrat, could you please share the names of libraries that allow this?

@vikassharma96
Copy link
Contributor

Hi @DorianMazur, Thank you for being an active maintainer! I need some suggestions on how to use this library to store two different values under different keychain options. Each value may be associated with a different service class, and I would like to apply different keychain options for unlocking them during retrieval like one using biometric authentication and the other with a direct method. Is this still feasible using this library?

@DorianMazur
Copy link
Collaborator

DorianMazur commented Dec 6, 2024

@vikassharma96 Absolutely. Use different service for each item.

// First
await setGenericPassword(
  'firstKey',
  firstKeyData,
  {
    service: 'com.myapp.firstKey'
    storage: STORAGE_TYPE.AES_GCM_NO_AUTH,
  }
);
// Second
await setGenericPassword(
  'secondKey',
  secondKeyData,
  {
    service: 'com.myapp.secondKey'
    storage: STORAGE_TYPE.AES_GCM,
  }
);

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

3 participants