Skip to content

Commit a14a3d7

Browse files
update to API 1.1.0-beta2
1 parent 162f40b commit a14a3d7

File tree

3 files changed

+41
-11
lines changed

3 files changed

+41
-11
lines changed

pom.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@
3838
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3939

4040
<!-- runtime dependencies -->
41-
<api.version>1.0.0</api.version>
41+
<api.version>1.1.0-beta2</api.version>
4242
<secret-service.version>1.7.0</secret-service.version>
43-
<kdewallet.version>1.2.3</kdewallet.version>
44-
<guava.version>31.0-jre</guava.version>
45-
<slf4j.version>1.7.32</slf4j.version>
43+
<kdewallet.version>1.2.6</kdewallet.version>
44+
<guava.version>31.0.1-jre</guava.version>
45+
<slf4j.version>1.7.36</slf4j.version>
4646

4747
<!-- test dependencies -->
48-
<junit.version>5.8.1</junit.version>
48+
<junit.version>5.8.2</junit.version>
4949
</properties>
5050

5151
<dependencies>
@@ -83,7 +83,6 @@
8383
</dependencies>
8484

8585
<build>
86-
8786
<plugins>
8887
<plugin>
8988
<groupId>org.apache.maven.plugins</groupId>

src/main/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccess.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package org.cryptomator.linux.keychain;
22

33
import com.google.common.base.Preconditions;
4+
import org.cryptomator.integrations.common.OperatingSystem;
5+
import org.cryptomator.integrations.common.Priority;
46
import org.cryptomator.integrations.keychain.KeychainAccessException;
57
import org.cryptomator.integrations.keychain.KeychainAccessProvider;
68
import org.freedesktop.dbus.connections.impl.DBusConnection;
@@ -14,6 +16,8 @@
1416

1517
import java.util.Optional;
1618

19+
@Priority(900)
20+
@OperatingSystem(OperatingSystem.Value.LINUX)
1721
public class KDEWalletKeychainAccess implements KeychainAccessProvider {
1822

1923
private static final Logger LOG = LoggerFactory.getLogger(KDEWalletKeychainAccess.class);
@@ -42,7 +46,13 @@ public boolean isLocked() {
4246
}
4347

4448
@Override
49+
@Deprecated
4550
public void storePassphrase(String key, CharSequence passphrase) throws KeychainAccessException {
51+
storePassphrase(key, null, passphrase);
52+
}
53+
54+
@Override
55+
public void storePassphrase(String key, String displayName, CharSequence passphrase) throws KeychainAccessException {
4656
Preconditions.checkState(wallet.isPresent(), "Keychain not supported.");
4757
wallet.get().storePassphrase(key, passphrase);
4858
}
@@ -60,7 +70,13 @@ public void deletePassphrase(String key) throws KeychainAccessException {
6070
}
6171

6272
@Override
73+
@Deprecated
6374
public void changePassphrase(String key, CharSequence passphrase) throws KeychainAccessException {
75+
changePassphrase(key, null, passphrase);
76+
}
77+
78+
@Override
79+
public void changePassphrase(String key, String displayName, CharSequence passphrase) throws KeychainAccessException {
6480
Preconditions.checkState(wallet.isPresent(), "Keychain not supported.");
6581
wallet.get().changePassphrase(key, passphrase);
6682
}

src/main/java/org/cryptomator/linux/keychain/SecretServiceKeychainAccess.java

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
package org.cryptomator.linux.keychain;
22

3+
import org.cryptomator.integrations.common.OperatingSystem;
4+
import org.cryptomator.integrations.common.Priority;
35
import org.cryptomator.integrations.keychain.KeychainAccessException;
46
import org.cryptomator.integrations.keychain.KeychainAccessProvider;
57
import org.freedesktop.secret.simple.SimpleCollection;
68

79
import java.io.IOException;
8-
import java.security.AccessControlException;
910
import java.util.List;
1011
import java.util.Map;
1112

13+
@Priority(900)
14+
@OperatingSystem(OperatingSystem.Value.LINUX)
1215
public class SecretServiceKeychainAccess implements KeychainAccessProvider {
1316

1417
private final String LABEL_FOR_SECRET_IN_KEYRING = "Cryptomator";
@@ -33,15 +36,21 @@ public boolean isLocked() {
3336
}
3437

3538
@Override
39+
@Deprecated
3640
public void storePassphrase(String key, CharSequence passphrase) throws KeychainAccessException {
41+
storePassphrase(key, null, passphrase);
42+
}
43+
44+
@Override
45+
public void storePassphrase(String key, String displayName, CharSequence passphrase) throws KeychainAccessException {
3746
try (SimpleCollection keyring = new SimpleCollection()) {
3847
List<String> list = keyring.getItems(createAttributes(key));
3948
if (list == null || list.isEmpty()) {
4049
keyring.createItem(LABEL_FOR_SECRET_IN_KEYRING, passphrase, createAttributes(key));
4150
} else {
4251
changePassphrase(key, passphrase);
4352
}
44-
} catch (IOException | AccessControlException e) {
53+
} catch (IOException | SecurityException e) {
4554
throw new KeychainAccessException("Storing password failed.", e);
4655
}
4756
}
@@ -55,7 +64,7 @@ public char[] loadPassphrase(String key) throws KeychainAccessException {
5564
} else {
5665
return null;
5766
}
58-
} catch (IOException | AccessControlException e) {
67+
} catch (IOException | SecurityException e) {
5968
throw new KeychainAccessException("Loading password failed.", e);
6069
}
6170
}
@@ -67,19 +76,25 @@ public void deletePassphrase(String key) throws KeychainAccessException {
6776
if (list != null && !list.isEmpty()) {
6877
keyring.deleteItem(list.get(0));
6978
}
70-
} catch (IOException | AccessControlException e) {
79+
} catch (IOException | SecurityException e) {
7180
throw new KeychainAccessException("Deleting password failed.", e);
7281
}
7382
}
7483

7584
@Override
85+
@Deprecated
7686
public void changePassphrase(String key, CharSequence passphrase) throws KeychainAccessException {
87+
changePassphrase(key, null, passphrase);
88+
}
89+
90+
@Override
91+
public void changePassphrase(String key, String displayName, CharSequence passphrase) throws KeychainAccessException {
7792
try (SimpleCollection keyring = new SimpleCollection()) {
7893
List<String> list = keyring.getItems(createAttributes(key));
7994
if (list != null && !list.isEmpty()) {
8095
keyring.updateItem(list.get(0), LABEL_FOR_SECRET_IN_KEYRING, passphrase, createAttributes(key));
8196
}
82-
} catch (IOException | AccessControlException e) {
97+
} catch (IOException | SecurityException e) {
8398
throw new KeychainAccessException("Changing password failed.", e);
8499
}
85100
}

0 commit comments

Comments
 (0)