3
3
import io .objectbox .annotation .apihint .Experimental ;
4
4
5
5
/**
6
- * Use the static helper methods to build sync credentials, for example {@link #apiKey SyncCredentials.apiKey("key")}.
6
+ * Use the static helper methods to build Sync credentials,
7
+ * for example {@link #sharedSecret(String) SyncCredentials.sharedSecret("secret")}.
7
8
*/
8
9
@ SuppressWarnings ("unused" )
9
10
@ Experimental
10
11
public class SyncCredentials {
11
12
12
13
/**
13
- * Authenticate with a pre-shared key.
14
- *
15
- * @param apiKey will be UTF-8 encoded
14
+ * Authenticate with a shared secret. This could be a passphrase, big number or randomly chosen bytes.
15
+ * The string is expected to use UTF-8 characters.
16
16
*/
17
- public static SyncCredentials apiKey (String apiKey ) {
18
- return new SyncCredentialsToken (CredentialsType .API_KEY , apiKey );
17
+ public static SyncCredentials sharedSecret (String secret ) {
18
+ return new SyncCredentialsToken (CredentialsType .SHARED_SECRET , secret );
19
19
}
20
20
21
21
/**
22
- * Authenticate with a pre- shared key .
22
+ * Authenticate with a shared secret. This could be a passphrase, big number or randomly chosen bytes .
23
23
*/
24
- public static SyncCredentials apiKey (byte [] apiKey ) {
25
- return new SyncCredentialsToken (CredentialsType .API_KEY , apiKey );
24
+ public static SyncCredentials sharedSecret (byte [] secret ) {
25
+ return new SyncCredentialsToken (CredentialsType .SHARED_SECRET , secret );
26
26
}
27
27
28
28
/**
@@ -34,7 +34,7 @@ public static SyncCredentials google(String idToken) {
34
34
}
35
35
36
36
/**
37
- * No authentication, insecure . Use only for development and testing purposes.
37
+ * No authentication, unsecured . Use only for development and testing purposes.
38
38
*/
39
39
public static SyncCredentials none () {
40
40
return new SyncCredentialsToken (CredentialsType .NONE );
@@ -45,7 +45,7 @@ public enum CredentialsType {
45
45
46
46
NONE (0 ),
47
47
48
- API_KEY (1 ),
48
+ SHARED_SECRET (1 ),
49
49
50
50
GOOGLE (2 );
51
51
0 commit comments