File tree Expand file tree Collapse file tree 3 files changed +18
-1
lines changed
src/main/java/org/cryptomator/linux/keychain Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 38
38
<project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
39
39
40
40
<!-- runtime dependencies -->
41
- <api .version>0.1.3 </api .version>
41
+ <api .version>1.0.0-beta2 </api .version>
42
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>
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 @@ -19,6 +19,16 @@ public boolean isSupported() {
19
19
return SimpleCollection .isAvailable ();
20
20
}
21
21
22
+ @ Override
23
+ public boolean isLocked () {
24
+ try (@ SuppressWarnings ("unused" ) SimpleCollection keyring = new SimpleCollection ()) {
25
+ // seems like we're able to access the keyring.
26
+ return keyring .isLocked ();
27
+ } catch (IOException | ExceptionInInitializerError | RuntimeException e ) {
28
+ return true ;
29
+ }
30
+ }
31
+
22
32
@ Override
23
33
public void storePassphrase (String key , CharSequence passphrase ) throws KeychainAccessException {
24
34
try (SimpleCollection keyring = new SimpleCollection ()) {
You can’t perform that action at this time.
0 commit comments