11package org .cryptomator .integrations .keychain ;
22
33import org .cryptomator .integrations .common .IntegrationsLoader ;
4+ import org .cryptomator .integrations .common .NamedServiceProvider ;
45import org .jetbrains .annotations .ApiStatus ;
56import org .jetbrains .annotations .Blocking ;
67import org .jetbrains .annotations .Nls ;
1112/**
1213 * This is the interface used by Cryptomator to store passwords securely in external keychains, such as system keychains or password managers.
1314 */
14- public interface KeychainAccessProvider {
15+ public interface KeychainAccessProvider extends NamedServiceProvider {
1516
1617 /**
1718 * Loads all available KeychainAccessProvider.
@@ -23,30 +24,6 @@ static Stream<KeychainAccessProvider> get() {
2324 return IntegrationsLoader .loadAll (KeychainAccessProvider .class ).filter (KeychainAccessProvider ::isSupported );
2425 }
2526
26- /**
27- * A name to display in UI elements. If required, this should be localized.
28- *
29- * @return user-friendly name (must not be null or empty)
30- */
31- @ Nls (capitalization = Nls .Capitalization .Title )
32- String displayName ();
33-
34- /**
35- * Associates a passphrase with a given key.
36- * <p>
37- * Note: Caller is responsible for zeroing the passphrase array after use.
38- *
39- * @param key Key used to retrieve the passphrase via {@link #loadPassphrase(String)}.
40- * @param passphrase The secret to store in this keychain.
41- * @throws KeychainAccessException If storing the password failed
42- * @deprecated Please use {@link #storePassphrase(String, String, CharSequence)} instead
43- */
44- @ Deprecated
45- @ ApiStatus .ScheduledForRemoval (inVersion = "1.2.0" )
46- default void storePassphrase (String key , CharSequence passphrase ) throws KeychainAccessException {
47- storePassphrase (key , null , passphrase );
48- }
49-
5027 /**
5128 * Associates a passphrase with a given key and a name for that key.
5229 * <p>
@@ -60,26 +37,7 @@ default void storePassphrase(String key, CharSequence passphrase) throws Keychai
6037 * @throws KeychainAccessException If storing the password failed
6138 */
6239 @ Blocking
63- default void storePassphrase (String key , @ Nullable String displayName , CharSequence passphrase ) throws KeychainAccessException {
64- storePassphrase (key , displayName , passphrase , false );
65- }
66-
67- /**
68- * Associates a passphrase with a given key and a name for that key.
69- * <p>
70- * Note: Caller is responsible for zeroing the passphrase array after use.
71- *
72- * @param key Key used to retrieve the passphrase via {@link #loadPassphrase(String)}.
73- * @param displayName The according name to the key. That's the name of the vault displayed in the UI.
74- * It's passed to the keychain as an additional information about the vault besides the key.
75- * The parameter does not need to be unique or be checked by the keychain.
76- * @param passphrase The secret to store in this keychain.
77- * @param requireOsAuthentication Defines, whether the user needs to authenticate to store a passphrase.
78- * The authentication mechanism is provided by the operating system dependent
79- * implementations of this API.
80- * @throws KeychainAccessException If storing the password failed
81- */
82- void storePassphrase (String key , @ Nullable String displayName , CharSequence passphrase , boolean requireOsAuthentication ) throws KeychainAccessException ;
40+ void storePassphrase (String key , @ Nullable String displayName , CharSequence passphrase ) throws KeychainAccessException ;
8341
8442 /**
8543 * @param key Unique key previously used while {@link #storePassphrase(String, String, CharSequence)} storing a passphrase}.
@@ -97,22 +55,6 @@ default void storePassphrase(String key, @Nullable String displayName, CharSeque
9755 */
9856 void deletePassphrase (String key ) throws KeychainAccessException ;
9957
100- /**
101- * Updates a passphrase with a given key. Noop, if there is no item for the given key.
102- * <p>
103- * Note: Caller is responsible for zeroing the passphrase array after use.
104- *
105- * @param key Unique key previously used while {@link #storePassphrase(String, String, CharSequence)} storing a passphrase}.
106- * @param passphrase The secret to be updated in this keychain.
107- * @throws KeychainAccessException If changing the password failed
108- * @deprecated Please use {@link #changePassphrase(String, String, CharSequence)} instead
109- */
110- @ Deprecated
111- @ ApiStatus .ScheduledForRemoval (inVersion = "1.2.0" )
112- default void changePassphrase (String key , CharSequence passphrase ) throws KeychainAccessException {
113- changePassphrase (key , null , passphrase );
114- }
115-
11658 /**
11759 * Updates a passphrase with a given key and stores a name for that key. Noop, if there is no item for the given key.
11860 * <p>
0 commit comments