Skip to content

Commit 215dd9d

Browse files
Merge pull request #5 from purejava/feature/displayName
Widen integrations-api to provide a name for a given key
2 parents 15b4742 + 420254d commit 215dd9d

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/main/java/org/cryptomator/integrations/keychain/KeychainAccessProvider.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,25 @@ public interface KeychainAccessProvider {
1818
* @param key Key used to retrieve the passphrase via {@link #loadPassphrase(String)}.
1919
* @param passphrase The secret to store in this keychain.
2020
* @throws KeychainAccessException If storing the password failed
21+
* @deprecated Please use {@link #storePassphrase(String, String, CharSequence)} instead
2122
*/
23+
@Deprecated
2224
void storePassphrase(String key, CharSequence passphrase) throws KeychainAccessException;
2325

26+
/**
27+
* Associates a passphrase with a given key and a name for that key.
28+
*
29+
* @param key Key used to retrieve the passphrase via {@link #loadPassphrase(String)}.
30+
* @param displayName The according name to the key. That's the name of the vault displayed in the UI.
31+
* It's passed to the keychain as an additional information about the vault besides the key.
32+
* The parameter does not need to be unique or be checked by the keychain.
33+
* @param passphrase The secret to store in this keychain.
34+
* @throws KeychainAccessException If storing the password failed
35+
*/
36+
default void storePassphrase(String key, String displayName, CharSequence passphrase) throws KeychainAccessException {
37+
storePassphrase(key, passphrase);
38+
}
39+
2440
/**
2541
* @param key Unique key previously used while {@link #storePassphrase(String, CharSequence) storing a passphrase}.
2642
* @return The stored passphrase for the given key or <code>null</code> if no value for the given key could be found.
@@ -42,9 +58,25 @@ public interface KeychainAccessProvider {
4258
* @param key Unique key previously used while {@link #storePassphrase(String, CharSequence) storing a passphrase}.
4359
* @param passphrase The secret to be updated in this keychain.
4460
* @throws KeychainAccessException If changing the password failed
61+
* @deprecated Please use {@link #changePassphrase(String, String, CharSequence)} instead
4562
*/
63+
@Deprecated
4664
void changePassphrase(String key, CharSequence passphrase) throws KeychainAccessException;
4765

66+
/**
67+
* Updates a passphrase with a given key and stores a name for that key. Noop, if there is no item for the given key.
68+
*
69+
* @param key Unique key previously used while {@link #storePassphrase(String, CharSequence) storing a passphrase}.
70+
* @param displayName The according name to the key. That's the name of the vault displayed in the UI.
71+
* It's passed to the keychain as an additional information about the vault besides the key.
72+
* The parameter does not need to be unique or be checked by the keychain.
73+
* @param passphrase The secret to be updated in this keychain.
74+
* @throws KeychainAccessException If changing the password failed
75+
*/
76+
default void changePassphrase(String key, String displayName, CharSequence passphrase) throws KeychainAccessException {
77+
changePassphrase(key, passphrase);
78+
}
79+
4880
/**
4981
* @return <code>true</code> if this KeychainAccessIntegration works on the current machine.
5082
* @implSpec This method must not throw any exceptions and should fail fast

0 commit comments

Comments
 (0)