Skip to content
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 71 commits into from
May 10, 2020
Merged

Add Dojo Support #14

merged 71 commits into from
May 10, 2020

Conversation

dergigi
Copy link

@dergigi dergigi commented May 8, 2020

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).

Simulator Screen Shot - iPhone 11 - 2020-05-08 at 14 01 03 (cropped)

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 the InitializingTorViewController to InitializingNetworkViewController and refactored some small things related to view updates.

I introduced Settings and a Sentinel.state to have a clean way of storing and figuring out the state of the app. The Settings 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

Simulator Screen Shot - iPhone 11 - 2020-05-08 at 14 01 03

Dojo Initialization on Startup

Simulator Screen Shot - iPhone 11 - 2020-05-08 at 14 00 15

Dojo Pairing Alert Sheet

Simulator Screen Shot - iPhone 11 - 2020-05-08 at 14 00 45

Disable Dojo (Alerts)

Simulator Screen Shot - iPhone 11 - 2020-05-08 at 14 00 30
Simulator Screen Shot - iPhone 11 - 2020-05-08 at 14 00 33

Tor and Dojo Connection States

Simulator Screen Shot - iPhone 11 - 2020-05-08 at 14 00 42
Simulator Screen Shot - iPhone 11 - 2020-05-08 at 14 00 40
Simulator Screen Shot - iPhone 11 - 2020-05-08 at 14 01 01
Simulator Screen Shot - iPhone 11 - 2020-05-08 at 14 00 25

Dojo Connection Errors

Simulator Screen Shot - iPhone 11 - 2020-05-08 at 14 25 05
Simulator Screen Shot - iPhone 11 - 2020-05-08 at 14 25 26
Simulator Screen Shot - iPhone 11 - 2020-05-08 at 14 26 05

dergigi added 29 commits May 6, 2020 11:33
@SamouraiDev SamouraiDev merged commit 47e132f into Samourai-Wallet:staging May 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants