Skip to content

Commit

Permalink
Merge pull request #5 from purejava/feature/displayName
Browse files Browse the repository at this point in the history
Widen integrations-api to provide a name for a given key
  • Loading branch information
overheadhunter authored Oct 8, 2021
2 parents 15b4742 + 420254d commit 215dd9d
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,25 @@ public interface KeychainAccessProvider {
* @param key Key used to retrieve the passphrase via {@link #loadPassphrase(String)}.
* @param passphrase The secret to store in this keychain.
* @throws KeychainAccessException If storing the password failed
* @deprecated Please use {@link #storePassphrase(String, String, CharSequence)} instead
*/
@Deprecated
void storePassphrase(String key, CharSequence passphrase) throws KeychainAccessException;

/**
* Associates a passphrase with a given key and a name for that key.
*
* @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
*/
default void storePassphrase(String key, String displayName, CharSequence passphrase) throws KeychainAccessException {
storePassphrase(key, passphrase);
}

/**
* @param key Unique key previously used while {@link #storePassphrase(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 All @@ -42,9 +58,25 @@ public interface KeychainAccessProvider {
* @param key Unique key previously used while {@link #storePassphrase(String, CharSequence) storing a passphrase}.
* @param passphrase The secret to be updated in this keychain.
* @throws KeychainAccessException If changing the password failed
* @deprecated Please use {@link #changePassphrase(String, String, CharSequence)} instead
*/
@Deprecated
void changePassphrase(String key, CharSequence passphrase) throws KeychainAccessException;

/**
* Updates a passphrase with a given key and stores a name for that key. Noop, if there is no item for the given key.
*
* @param key Unique key previously used while {@link #storePassphrase(String, CharSequence) storing a passphrase}.
* @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 be updated in this keychain.
* @throws KeychainAccessException If changing the password failed
*/
default void changePassphrase(String key, String displayName, CharSequence passphrase) throws KeychainAccessException {
changePassphrase(key, passphrase);
}

/**
* @return <code>true</code> if this KeychainAccessIntegration works on the current machine.
* @implSpec This method must not throw any exceptions and should fail fast
Expand Down

0 comments on commit 215dd9d

Please sign in to comment.