remove flutter secure storage explicit instantiations from wow/xmr

This commit is contained in:
julian 2022-11-11 12:12:01 -06:00
parent ba853837ce
commit 9b09f65f4d
3 changed files with 16 additions and 25 deletions

View file

@ -154,6 +154,7 @@ void main() async {
await Hive.openBox<dynamic>(DB.boxNameDBInfo);
// todo: db migrate stuff for desktop needs to be handled eventually
if (!Util.isDesktop) {
int dbVersion = DB.instance.get<dynamic>(
boxName: DB.boxNameDBInfo, key: "hive_data_version") as int? ??

View file

@ -23,7 +23,6 @@ import 'package:flutter_libmonero/core/key_service.dart';
import 'package:flutter_libmonero/core/wallet_creation_service.dart';
import 'package:flutter_libmonero/monero/monero.dart';
import 'package:flutter_libmonero/view_model/send/output.dart' as monero_output;
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:http/http.dart';
import 'package:mutex/mutex.dart';
import 'package:path_provider/path_provider.dart';
@ -670,11 +669,10 @@ class MoneroWallet extends CoinServiceAPI {
"Attempted to overwrite mnemonic on generate new wallet!");
}
storage = const FlutterSecureStorage();
walletService =
monero.createMoneroWalletService(DB.instance.moneroWalletInfoBox);
prefs = await SharedPreferences.getInstance();
keysStorage = KeyService(storage!);
keysStorage = KeyService(_secureStore);
WalletInfo walletInfo;
WalletCredentials credentials;
try {
@ -708,7 +706,7 @@ class MoneroWallet extends CoinServiceAPI {
credentials.walletInfo = walletInfo;
_walletCreationService = WalletCreationService(
secureStorage: storage,
secureStorage: _secureStore,
sharedPreferences: prefs,
walletService: walletService,
keyService: keysStorage,
@ -787,11 +785,11 @@ class MoneroWallet extends CoinServiceAPI {
// Logging.instance.log("Caught in initializeWallet(): $e\n$s");
// return false;
// }
storage = const FlutterSecureStorage();
walletService =
monero.createMoneroWalletService(DB.instance.moneroWalletInfoBox);
prefs = await SharedPreferences.getInstance();
keysStorage = KeyService(storage!);
keysStorage = KeyService(_secureStore);
await _generateNewWallet();
// var password;
@ -833,11 +831,10 @@ class MoneroWallet extends CoinServiceAPI {
"Attempted to initialize an existing wallet using an unknown wallet ID!");
}
storage = const FlutterSecureStorage();
walletService =
monero.createMoneroWalletService(DB.instance.moneroWalletInfoBox);
prefs = await SharedPreferences.getInstance();
keysStorage = KeyService(storage!);
keysStorage = KeyService(_secureStore);
await _prefs.init();
final data =
@ -889,7 +886,7 @@ class MoneroWallet extends CoinServiceAPI {
bool longMutex = false;
// TODO: are these needed?
FlutterSecureStorage? storage;
WalletService? walletService;
SharedPreferences? prefs;
KeyService? keysStorage;
@ -970,11 +967,10 @@ class MoneroWallet extends CoinServiceAPI {
await DB.instance
.put<dynamic>(boxName: walletId, key: "restoreHeight", value: height);
storage = const FlutterSecureStorage();
walletService =
monero.createMoneroWalletService(DB.instance.moneroWalletInfoBox);
prefs = await SharedPreferences.getInstance();
keysStorage = KeyService(storage!);
keysStorage = KeyService(_secureStore);
WalletInfo walletInfo;
WalletCredentials credentials;
String name = _walletId;
@ -1001,7 +997,7 @@ class MoneroWallet extends CoinServiceAPI {
credentials.walletInfo = walletInfo;
_walletCreationService = WalletCreationService(
secureStorage: storage,
secureStorage: _secureStore,
sharedPreferences: prefs,
walletService: walletService,
keyService: keysStorage,

View file

@ -1,7 +1,6 @@
import 'dart:async';
import 'dart:io';
import 'package:cw_core/get_height_by_date.dart';
import 'package:cw_core/monero_transaction_priority.dart';
import 'package:cw_core/node.dart';
import 'package:cw_core/pending_transaction.dart';
@ -25,7 +24,6 @@ import 'package:flutter_libmonero/core/wallet_creation_service.dart';
import 'package:flutter_libmonero/view_model/send/output.dart'
as wownero_output;
import 'package:flutter_libmonero/wownero/wownero.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:http/http.dart';
import 'package:mutex/mutex.dart';
import 'package:path_provider/path_provider.dart';
@ -672,12 +670,11 @@ class WowneroWallet extends CoinServiceAPI {
"Attempted to overwrite mnemonic on generate new wallet!");
}
storage = const FlutterSecureStorage();
// TODO: Wallet Service may need to be switched to Wownero
walletService =
wownero.createWowneroWalletService(DB.instance.moneroWalletInfoBox);
prefs = await SharedPreferences.getInstance();
keysStorage = KeyService(storage!);
keysStorage = KeyService(_secureStore);
WalletInfo walletInfo;
WalletCredentials credentials;
try {
@ -702,7 +699,7 @@ class WowneroWallet extends CoinServiceAPI {
credentials.walletInfo = walletInfo;
_walletCreationService = WalletCreationService(
secureStorage: storage,
secureStorage: _secureStore,
sharedPreferences: prefs,
walletService: walletService,
keyService: keysStorage,
@ -793,11 +790,10 @@ class WowneroWallet extends CoinServiceAPI {
// Logging.instance.log("Caught in initializeWallet(): $e\n$s");
// return false;
// }
storage = const FlutterSecureStorage();
walletService =
wownero.createWowneroWalletService(DB.instance.moneroWalletInfoBox);
prefs = await SharedPreferences.getInstance();
keysStorage = KeyService(storage!);
keysStorage = KeyService(_secureStore);
await _generateNewWallet(seedWordsLength: seedWordsLength);
// var password;
@ -839,11 +835,10 @@ class WowneroWallet extends CoinServiceAPI {
"Attempted to initialize an existing wallet using an unknown wallet ID!");
}
storage = const FlutterSecureStorage();
walletService =
wownero.createWowneroWalletService(DB.instance.moneroWalletInfoBox);
prefs = await SharedPreferences.getInstance();
keysStorage = KeyService(storage!);
keysStorage = KeyService(_secureStore);
await _prefs.init();
final data =
@ -895,7 +890,7 @@ class WowneroWallet extends CoinServiceAPI {
bool longMutex = false;
// TODO: are these needed?
FlutterSecureStorage? storage;
WalletService? walletService;
SharedPreferences? prefs;
KeyService? keysStorage;
@ -993,11 +988,10 @@ class WowneroWallet extends CoinServiceAPI {
await DB.instance
.put<dynamic>(boxName: walletId, key: "restoreHeight", value: height);
storage = const FlutterSecureStorage();
walletService =
wownero.createWowneroWalletService(DB.instance.moneroWalletInfoBox);
prefs = await SharedPreferences.getInstance();
keysStorage = KeyService(storage!);
keysStorage = KeyService(_secureStore);
WalletInfo walletInfo;
WalletCredentials credentials;
String name = _walletId;
@ -1024,7 +1018,7 @@ class WowneroWallet extends CoinServiceAPI {
credentials.walletInfo = walletInfo;
_walletCreationService = WalletCreationService(
secureStorage: storage,
secureStorage: _secureStore,
sharedPreferences: prefs,
walletService: walletService,
keyService: keysStorage,