-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve signal handling for kdewallet #3
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, i like the async approach. But...
the current keychain interface is not designed for async usage, its methods return "hard" values.
I made a small integration test with this PR and the results are as expected. You can store a vault password in KWallet, then lock the wallet and afterwards try to unlock the vault again. The result is the Unlock dialogue opens. And if you wait maybe 4 seconds, next to the unlock dialogue the KWallet password prompt pops up. But even if you unlock the wallet then, the stored password cannot be used in the current unlock dialogue.
Of course downstream the unlock dialogue can be redesigned to poll for availability, but currently are no plans.
I suggest to wait for an answer a short time period and if none comes, return the correct value.
@@ -11,9 +11,11 @@ | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
|
|||
import java.beans.PropertyChangeEvent; | |||
import java.beans.PropertyChangeListener; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there better alternatives? If at any point in the future the JPMS is introduced in this library, this leads to a dependency to the java.desktop
module, which imho should not be present in this "system" library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot get the interconnection between the JPMS and the PropertyChangeListener pattern I introduced here.
Can you elaborate you point further?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pattern fine!
The classes from the java.beans
package are part of the java.desktop
module. So if this library will be migrated to the module system, it needs a dependeny to this module.
From my perspective, this is a "system" library and should not depend in java.desktop
. But I'm also a little nitpicky here 😄
src/main/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccess.java
Outdated
Show resolved
Hide resolved
That's the design so far. The two components Cryptomator and the kwallet backend were designed to work independently.
Who should wait for what answer and who should return which value? 🙂 |
I second that, but it needs a change in the keychain API, which, as a consequence, leads to a bigger refactoring(main project, other integrations libs).
The functions of the keychain API for answer of the implemented keychain. E.g. |
Could you please retest with a current Cryptomator? In case the wallet is locked, the pop-up to open it is displayed and Cryptomator waits for the desired 120 seconds. The enter password dialog from Cryptomator does not show up during that time. |
Can this be closed? Looking at the diff, I guess it is obsolete |
Not really obsolete, as the code still uses the depracated integrations-linux/src/main/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccess.java Line 188 in 1c23d06
|
# Conflicts: # pom.xml # src/main/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccess.java
I merged develop into this branch, making the inner class implement the proposed PropertyChangeListener. Can you please check if this is correct? |
From looking at the MR code it looks ok. I wanted to compile the code, but could not find any branch of |
Wrong remote, I guess? It should be in your fork, according to the metadata shown here. |
Yeah, it is. This sometimes confuses me: which branch of which fork of which repo. I can't compile the change:
|
The method is implemented though. Lines 79 and 69 resp. 🤔 |
D-Bus signals are emitted on every change to a wallet, e.g. when it's opened asynchronously, closed etc.. Cryptomator checks for these signals and processes them.
Signal handling in kdewallet does work well [1], but could be improved in some regards:
SignalHandler#await
method keeps the running application in a loop and waits for the signal to listen for until the signal was emitted or a timeout is reachedSignalHandler
does not support to catch signals asynchronouslykdewallet 1.2.0 solves this by providing a re-designed
SignalHandler
to handle signals asynchronously and makeSignalHandler
more robust against timed out D-Bus calls.To make use of the new features, integrations-linux needs slight changes. And that’s the motivation for this PR.
Here is what happens in Cryptomator without and with this change:
SignalHandler
in kdewallet 1.1.1:SignalHandler
in kdewallet 1.2.0:[1] the current kdewallet implementation within the integrations-api does work without this PR