-
-
Notifications
You must be signed in to change notification settings - Fork 956
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
Refactored Hub Unlock #3287
Refactored Hub Unlock #3287
Conversation
as we will now re-attempt unlock when returning from device registration [ci skip]
WalkthroughThe recent updates to Cryptomator's UI components reflect a significant shift towards a more user-friendly experience, particularly in the domain of Hub device creation for vault access. By allowing the setup of a Hub device prior to having vault access, the updates aim to streamline the process, removing unnecessary steps and creating a smoother flow, which aligns with the objectives to enhance user experience and eliminate policy limitations. Changes
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (4)
- src/main/java/org/cryptomator/ui/keyloading/hub/HubConfig.java (2 hunks)
- src/main/java/org/cryptomator/ui/keyloading/hub/ReceiveKeyController.java (5 hunks)
- src/main/java/org/cryptomator/ui/keyloading/hub/RegisterSuccessController.java (1 hunks)
- src/main/resources/fxml/hub_register_success.fxml (1 hunks)
Additional comments: 14
src/main/java/org/cryptomator/ui/keyloading/hub/HubConfig.java (1)
- 21-26: The new method
getApiBaseUrl()
is correctly implemented to ensure the URI ends with a slash and handles the presence or absence ofapiBaseUrl
.src/main/java/org/cryptomator/ui/keyloading/hub/RegisterSuccessController.java (1)
- 24-29: The constructor changes, the replacement of the
close
method withcomplete
, and the addition of thewindowClosed
method are all aligned with the PR objectives and are correctly implemented.src/main/resources/fxml/hub_register_success.fxml (1)
- 44-46: The changes to the
ButtonBar
component's button order and the associated button actions in the FXML file are consistent with the updated UI flow.src/main/java/org/cryptomator/ui/keyloading/hub/ReceiveKeyController.java (11)
- 6-6: The addition of the
com.google.common.base.Preconditions
import is appropriate for performing state checks within the methods.- 50-60: The new fields added, such as
vaultId
, and the removal ofvaultBaseUri
, align with the changes in the vault ID handling process.- 84-85: The
receiveKey
method is correctly implemented to initiate the key retrieval process.- 91-100: The
requestApiConfig
method is correctly implemented to request the API configuration, handling the response asynchronously.- 107-120: The
receivedApiConfig
method correctly processes the API configuration response and decides the next step based on theapiLevel
.- 125-133: The
requestVaultMasterkey
method is correctly implemented to request the vault master key, using the newAPI_BASE
field for URI resolution.- 142-150: The
receivedVaultMasterkey
method correctly handles the various HTTP status codes and the associated actions.- 156-164: The
requestDeviceData
method is correctly implemented to request the user key for the device.- 173-181: The
receivedDeviceData
method correctly processes the device data response and requests the vault master key if successful.- 193-200: The
receivedBothEncryptedKeys
method is correctly implemented to handle the reception of both encrypted keys and complete the result.- 291-300: The
resolveRelativeToApiBase
andextractVaultId
methods are correctly implemented to resolve URIs relative to the API base and extract the vault ID.
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.
Apart from an already existing issue, a very clean solution! 👍
src/main/java/org/cryptomator/ui/keyloading/hub/ReceiveKeyController.java
Show resolved
Hide resolved
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.
Regarding
Tested Device Registration with consecutive Unlock on Hub 1.2.x
currently an exception is thrown due to missing translation key. WIll fix it asap.
(cherry picked from commit daa026b)
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- src/main/resources/i18n/strings.properties (1 hunks)
Additional comments: 1
src/main/resources/i18n/strings.properties (1)
- 166-166: The addition of the message key
hub.register.occupiedMsg
with the value "Name already in use" is clear and follows the existing naming conventions and structure of the properties file.
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.
Tested with 1.2.2 the unlock and device registration.
@infeo could you also run another test on both 1.2.x and 1.3.x:
Expected result: 1.3.x lets you register the device but fails to unlock. After granting access again, unlock succeeds immediately. 1.2.x should still require device access grant first. |
Let's have a call, as I suspect this is the expected behavior. I'd like to better understand why you think this is a failure. |
call made, misunderstandings resolved. The (second) test expectations for 1.3.x was not clear enough/ we might have found a bug in the frontend. This will be documented somewhere else. |
This fixes #3247 by changing the order of
GET /api/devices/{deviceId}
andGET /api/vaults/{vaultId}/access-token
. By first retrieving the device data, we can identify non-registered devices before attempting vault unlock. This also fixes a TODO to immediately unlock after device registration.Furthermore this PR changes how we distinguish legacy (pre Hub 1.3.0) vs current vault unlock. Instead of relying on HTTP status code 404 returned from
GET /api/vaults/{vaultId}/access-token
, we will look at theapiLevel
returned fromGET /api/config
.This is the first step to adjust the workflow as depicted in the following diagram, however it does not yet contain the Legacy Device Migration (separate PR will follow):
Summary by CodeRabbit
New Features
Refactor
Style
Chores