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 3838 <project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
3939
4040 <!-- runtime dependencies -->
41- <api .version>0.1.3 </api .version>
41+ <api .version>1.0.0-beta2 </api .version>
4242 <secret-service .version>1.5.0</secret-service .version>
4343 <kdewallet .version>1.1.1</kdewallet .version>
4444 <guava .version>30.0-jre</guava .version>
Original file line number Diff line number Diff line change @@ -47,6 +47,11 @@ public boolean isSupported() {
4747 return wallet .map (ConnectedWallet ::isSupported ).orElse (false );
4848 }
4949
50+ @ Override
51+ public boolean isLocked () {
52+ return wallet .map (ConnectedWallet ::isLocked ).orElse (false );
53+ }
54+
5055 @ Override
5156 public void storePassphrase (String key , CharSequence passphrase ) throws KeychainAccessException {
5257 Preconditions .checkState (wallet .isPresent (), "Keychain not supported." );
@@ -84,6 +89,8 @@ public boolean isSupported() {
8489 return wallet .isEnabled ();
8590 }
8691
92+ public boolean isLocked () { return !wallet .isOpen (Static .DEFAULT_WALLET ); }
93+
8794 public void storePassphrase (String key , CharSequence passphrase ) throws KeychainAccessException {
8895 try {
8996 if (walletIsOpen () &&
Original file line number Diff line number Diff line change @@ -19,6 +19,16 @@ public boolean isSupported() {
1919 return SimpleCollection .isAvailable ();
2020 }
2121
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+
2232 @ Override
2333 public void storePassphrase (String key , CharSequence passphrase ) throws KeychainAccessException {
2434 try (SimpleCollection keyring = new SimpleCollection ()) {
You can’t perform that action at this time.
0 commit comments