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

Widen API to allow storing keychain entries for an authenticated user #41

Merged
merged 6 commits into from
Aug 16, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,22 @@ default void storePassphrase(String key, CharSequence passphrase) throws Keychai
@Blocking
void storePassphrase(String key, @Nullable String displayName, CharSequence passphrase) throws KeychainAccessException;

/**
* Associates a passphrase with a given key and a name for that key. Other than
* {@link #storePassphrase(String key, String displayName, CharSequence passphrase)}, the user needs to authenticate
* to store a passphrase. The authentication mechanism is provided by the operating system dependent
* implementations of this API.
*
* @param key Key used to retrieve the passphrase via {@link #loadPassphrase(String)}.
* @param displayName The according name to the key. That's the name of the vault displayed in the UI.
* It's passed to the keychain as an additional information about the vault besides the key.
* The parameter does not need to be unique or be checked by the keychain.
* @param passphrase The secret to store in this keychain.
* @throws KeychainAccessException If storing the password failed
*/
@Blocking
void storePassphraseForAuthenticatedUser(String key, @Nullable String displayName, CharSequence passphrase) throws KeychainAccessException;

/**
* @param key Unique key previously used while {@link #storePassphrase(String, String, CharSequence)} storing a passphrase}.
* @return The stored passphrase for the given key or <code>null</code> if no value for the given key could be found.
Expand Down