-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add Dojo Support #14
Merged
Merged
Add Dojo Support #14
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support to pair your Sentinel app with your Dojo. All requests that would usually be sent to the Samourai backend are sent to your Dojo instead (if the pairing was successful).
I build up on the work done in #11 - I refactored some parts of some Tor components, e.g. to add (optional) completion handlers to the
startTor
method so that Tor initialization can be easily chained with the Dojo initialization. I also renamed theInitializingTorViewController
toInitializingNetworkViewController
and refactored some small things related to view updates.I introduced
Settings
and aSentinel.state
to have a clean way of storing and figuring out the state of the app. TheSettings
could also be extended to provide functionality for other app settings that are currently set in different places. I propose to implement that improvement in another PR.The network initializes on app start, according to the user's settings. If Tor is enabled, Tor will initialize. If Dojo is enabled, Tor will initialize before connecting to the user's Dojo (obviously). Tor will also be enabled automatically if needed as soon as the user starts the pairing process.
Alerts are shown if the user wants to disable Dojo, since this is a destructive action. The user is warned that the Dojo pairing has to be done again. (Note: This could be a non-destructive action as well, but I decided to mirror the behavior as it is on Android.)
The connection state is shown in the Network/Connections view, for both Tor and Dojo. Errors are handled where necessary, showing a simplified failure reason to the user.
The Dojo pairing details are stored securely in the keychain (so that the app can reconnect on startup), as are the authentication tokens that are returned upon successful pairing. All Dojo-related data is deleted if the user decides to disable Dojo.
Note: Before this goes into production, some parts of the
RootNavigationController
should be refactored. In particular how the view controllers are set up based on the app state. I didn't touch this yet since I want to keep changes as atomic as possible. Further, the way the app checks if a PIN is set or not should be improved, since the PIN isn't the only thing anymore that's stored in the keychain. I would like to fix these issues in separate PRs.More screenshots
Dojo Initialization on Startup
Dojo Pairing Alert Sheet
Disable Dojo (Alerts)
Tor and Dojo Connection States
Dojo Connection Errors