-
Notifications
You must be signed in to change notification settings - Fork 15
Enable Tor on mobile #473
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
Open
piatoss3612
wants to merge
12
commits into
main
Choose a base branch
from
rowan/mobile-tor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+3,255
−131
Open
Enable Tor on mobile #473
Changes from 6 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3c11fe2
[mobile] Make the embedded Tor client usable on iOS and Android
piatoss3612 ed26f78
[mobile] Apply the persisted Tor route on mobile
piatoss3612 1276e96
[mobile] Add the Tor control to mobile settings
piatoss3612 d17fc3b
[mobile] Keep Tor guard state off device backups
piatoss3612 560dc74
[mobile] Let background work use Tor on power and an unmetered link
piatoss3612 a2b1be1
[mobile] Add a manual Tor bootstrap probe
piatoss3612 b06cacc
[mobile] Keep the Tor client's runtime alive across FFI calls
piatoss3612 5e66ae1
[mobile] Give background broadcasts their own circuit, and re-arm dec…
piatoss3612 8bb5330
[mobile] Let expiry reach a blocking bring-up, and re-arm a stood-dow…
piatoss3612 890d645
[mobile] Wait for an affordable route on a request that can hold a wait
piatoss3612 588dc39
[mobile] Read fresh state when deciding what a wake may do
piatoss3612 6984f9f
[mobile] Mark the Tor directory before a native bootstrap fills it
piatoss3612 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <!-- | ||
| Arti's directory records which guards this wallet chose. Carrying it to a | ||
| second device would carry that choice with it, so a transferred install picks | ||
| fresh guards at the cost of one bootstrap. | ||
|
|
||
| `allowBackup="false"` already covers cloud backup, but from target SDK 31 | ||
| device-to-device transfer is governed here instead and defaults to including | ||
| app data. `domain="file"` is getFilesDir(), which is what | ||
| getApplicationSupportDirectory() resolves to on Android. | ||
| --> | ||
| <data-extraction-rules> | ||
| <cloud-backup> | ||
| <exclude domain="file" path="tor" /> | ||
| </cloud-backup> | ||
| <device-transfer> | ||
| <exclude domain="file" path="tor" /> | ||
| </device-transfer> | ||
| </data-extraction-rules> |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import 'package:flutter_test/flutter_test.dart'; | ||
| import 'package:integration_test/integration_test.dart'; | ||
| import 'package:zcash_wallet/src/core/storage/wallet_paths.dart'; | ||
| import 'package:zcash_wallet/src/rust/api/network_privacy.dart' | ||
| as rust_network_privacy; | ||
| import 'package:zcash_wallet/src/rust/frb_generated.dart'; | ||
| import 'package:zcash_wallet/src/rust/network_privacy.dart' as rust_types; | ||
|
|
||
| /// Bootstraps Tor from the app's own support directory on a mobile OS. | ||
| /// | ||
| /// A bootstrap failure surfaces from inside fail-closed mode — every request | ||
| /// blocked while Tor never becomes ready — so no host test can catch it. This | ||
| /// talks to the live Tor network and is not part of any automated lane; run it | ||
| /// by hand against a booted simulator or device. | ||
| /// | ||
| /// What it does not settle: whether arti's filesystem permission checks need | ||
| /// the mobile exemption. The iOS simulator passes this with the exemption | ||
| /// compiled out, because a simulator container is an ordinary directory in the | ||
| /// host filesystem. Only a real device answers that. | ||
| void main() { | ||
| IntegrationTestWidgetsFlutterBinding.ensureInitialized(); | ||
|
|
||
| testWidgets('Tor bootstraps from the mobile app sandbox', (tester) async { | ||
| await RustLib.init(); | ||
| final torDirectory = await getTorDataDirectoryPath(); | ||
|
|
||
| rust_network_privacy.beginNetworkPrivacyEnable(); | ||
| final status = await rust_network_privacy.configureNetworkPrivacy( | ||
| enabled: true, | ||
| torDirectory: torDirectory, | ||
| ); | ||
|
|
||
| expect( | ||
| status, | ||
| rust_types.NetworkPrivacyStatus.ready, | ||
| reason: 'bootstrap from $torDirectory did not reach ready', | ||
| ); | ||
| expect(rust_network_privacy.isTorEnabled(), isTrue); | ||
| }, timeout: const Timeout(Duration(minutes: 5))); | ||
| } |
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.