diff --git a/pom.xml b/pom.xml
index 9edc119..546d78d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -38,7 +38,7 @@
UTF-8
- 0.1.3
+ 1.0.0-beta2
1.5.0
1.1.1
30.0-jre
diff --git a/src/main/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccess.java b/src/main/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccess.java
index a7b5c7b..0e5bb6b 100644
--- a/src/main/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccess.java
+++ b/src/main/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccess.java
@@ -47,6 +47,11 @@ public boolean isSupported() {
return wallet.map(ConnectedWallet::isSupported).orElse(false);
}
+ @Override
+ public boolean isLocked() {
+ return wallet.map(ConnectedWallet::isLocked).orElse(false);
+ }
+
@Override
public void storePassphrase(String key, CharSequence passphrase) throws KeychainAccessException {
Preconditions.checkState(wallet.isPresent(), "Keychain not supported.");
@@ -84,6 +89,8 @@ public boolean isSupported() {
return wallet.isEnabled();
}
+ public boolean isLocked() { return !wallet.isOpen(Static.DEFAULT_WALLET); }
+
public void storePassphrase(String key, CharSequence passphrase) throws KeychainAccessException {
try {
if (walletIsOpen() &&
diff --git a/src/main/java/org/cryptomator/linux/keychain/SecretServiceKeychainAccess.java b/src/main/java/org/cryptomator/linux/keychain/SecretServiceKeychainAccess.java
index 1e8dba0..1d6c714 100644
--- a/src/main/java/org/cryptomator/linux/keychain/SecretServiceKeychainAccess.java
+++ b/src/main/java/org/cryptomator/linux/keychain/SecretServiceKeychainAccess.java
@@ -19,6 +19,16 @@ public boolean isSupported() {
return SimpleCollection.isAvailable();
}
+ @Override
+ public boolean isLocked() {
+ try (@SuppressWarnings("unused") SimpleCollection keyring = new SimpleCollection()) {
+ // seems like we're able to access the keyring.
+ return keyring.isLocked();
+ } catch (IOException | ExceptionInInitializerError | RuntimeException e) {
+ return true;
+ }
+ }
+
@Override
public void storePassphrase(String key, CharSequence passphrase) throws KeychainAccessException {
try (SimpleCollection keyring = new SimpleCollection()) {