File tree 3 files changed +20
-3
lines changed
src/main/java/org/cryptomator/linux/keychain
3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 5
5
<modelVersion >4.0.0</modelVersion >
6
6
<groupId >org.cryptomator</groupId >
7
7
<artifactId >integrations-linux</artifactId >
8
- <version >0.1.1 </version >
8
+ <version >0.2.0-SNAPSHOT </version >
9
9
10
10
<name >integrations-linux</name >
11
11
<description >Provides optional Linux services used by Cryptomator</description >
38
38
<project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
39
39
40
40
<!-- runtime dependencies -->
41
- <api .version>0.1.3 </api .version>
42
- <secret-service .version>1.2.1 </secret-service .version>
41
+ <api .version>1.0.0-beta2 </api .version>
42
+ <secret-service .version>1.5.0 </secret-service .version>
43
43
<kdewallet .version>1.1.1</kdewallet .version>
44
44
<guava .version>30.0-jre</guava .version>
45
45
<slf4j .version>1.7.30</slf4j .version>
Original file line number Diff line number Diff line change @@ -47,6 +47,11 @@ public boolean isSupported() {
47
47
return wallet .map (ConnectedWallet ::isSupported ).orElse (false );
48
48
}
49
49
50
+ @ Override
51
+ public boolean isLocked () {
52
+ return wallet .map (ConnectedWallet ::isLocked ).orElse (false );
53
+ }
54
+
50
55
@ Override
51
56
public void storePassphrase (String key , CharSequence passphrase ) throws KeychainAccessException {
52
57
Preconditions .checkState (wallet .isPresent (), "Keychain not supported." );
@@ -84,6 +89,8 @@ public boolean isSupported() {
84
89
return wallet .isEnabled ();
85
90
}
86
91
92
+ public boolean isLocked () { return !wallet .isOpen (Static .DEFAULT_WALLET ); }
93
+
87
94
public void storePassphrase (String key , CharSequence passphrase ) throws KeychainAccessException {
88
95
try {
89
96
if (walletIsOpen () &&
Original file line number Diff line number Diff line change @@ -23,6 +23,16 @@ public boolean isSupported() {
23
23
}
24
24
}
25
25
26
+ @ Override
27
+ public boolean isLocked () {
28
+ try (@ SuppressWarnings ("unused" ) SimpleCollection keyring = new SimpleCollection ()) {
29
+ // seems like we're able to access the keyring.
30
+ return keyring .isLocked ();
31
+ } catch (IOException | ExceptionInInitializerError | RuntimeException e ) {
32
+ return true ;
33
+ }
34
+ }
35
+
26
36
@ Override
27
37
public void storePassphrase (String key , CharSequence passphrase ) throws KeychainAccessException {
28
38
try (SimpleCollection keyring = new SimpleCollection ()) {
You can’t perform that action at this time.
0 commit comments