1
1
package org .cryptomator .integrations .keychain ;
2
2
3
3
import org .cryptomator .integrations .common .IntegrationsLoader ;
4
+ import org .cryptomator .integrations .common .NamedServiceProvider ;
4
5
import org .jetbrains .annotations .ApiStatus ;
5
6
import org .jetbrains .annotations .Blocking ;
6
7
import org .jetbrains .annotations .Nls ;
11
12
/**
12
13
* This is the interface used by Cryptomator to store passwords securely in external keychains, such as system keychains or password managers.
13
14
*/
14
- public interface KeychainAccessProvider {
15
+ public interface KeychainAccessProvider extends NamedServiceProvider {
15
16
16
17
/**
17
18
* Loads all available KeychainAccessProvider.
@@ -23,30 +24,6 @@ static Stream<KeychainAccessProvider> get() {
23
24
return IntegrationsLoader .loadAll (KeychainAccessProvider .class ).filter (KeychainAccessProvider ::isSupported );
24
25
}
25
26
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
-
50
27
/**
51
28
* Associates a passphrase with a given key and a name for that key.
52
29
* <p>
@@ -60,26 +37,7 @@ default void storePassphrase(String key, CharSequence passphrase) throws Keychai
60
37
* @throws KeychainAccessException If storing the password failed
61
38
*/
62
39
@ 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 ;
83
41
84
42
/**
85
43
* @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
97
55
*/
98
56
void deletePassphrase (String key ) throws KeychainAccessException ;
99
57
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
-
116
58
/**
117
59
* Updates a passphrase with a given key and stores a name for that key. Noop, if there is no item for the given key.
118
60
* <p>
0 commit comments