stack_wallet/lib/networking/tor_service.dart

23 lines
576 B
Dart
Raw Normal View History

import 'package:flutter_libarti/flutter_libarti.dart';
2023-08-07 16:39:04 +00:00
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/utilities/stack_file_system.dart';
2023-08-07 16:46:34 +00:00
final pTorService = Provider((_) => TorService.sharedInstance);
2023-08-07 16:39:04 +00:00
class TorService {
2023-08-07 16:46:34 +00:00
static final sharedInstance = TorService();
2023-08-07 16:39:04 +00:00
final _tor = Tor();
int get port => _tor.port;
Future<void> start() async {
final dir = await StackFileSystem.applicationTorDirectory();
await _tor.start(torDir: dir);
return;
2023-08-07 16:39:04 +00:00
}
Future<void> stop() async {
return await _tor.disable();
}
}