mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-18 10:11:03 +00:00
22 lines
574 B
Dart
22 lines
574 B
Dart
import 'package:flutter_libtor/flutter_libtor.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:stackwallet/utilities/stack_file_system.dart';
|
|
|
|
final pTorService = Provider((_) => TorService.sharedInstance);
|
|
|
|
class TorService {
|
|
static final sharedInstance = TorService();
|
|
final _tor = Tor();
|
|
|
|
int get port => _tor.port;
|
|
|
|
Future<void> start() async {
|
|
final dir = await StackFileSystem.applicationTorDirectory();
|
|
await _tor.start(torDir: dir);
|
|
return;
|
|
}
|
|
|
|
Future<void> stop() async {
|
|
return await _tor.disable();
|
|
}
|
|
}
|