Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.cryptomator</groupId>
<artifactId>integrations-linux</artifactId>
<version>0.1.1</version>
<version>0.2.0-SNAPSHOT</version>

<name>integrations-linux</name>
<description>Provides optional Linux services used by Cryptomator</description>
Expand Down Expand Up @@ -38,8 +38,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- runtime dependencies -->
<api.version>0.1.3</api.version>
<secret-service.version>1.2.1</secret-service.version>
<api.version>1.0.0-beta2</api.version>
<secret-service.version>1.5.0</secret-service.version>
<kdewallet.version>1.1.1</kdewallet.version>
<guava.version>30.0-jre</guava.version>
<slf4j.version>1.7.30</slf4j.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand Down Expand Up @@ -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() &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ public boolean isSupported() {
}
}

@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()) {
Expand Down