mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-01 01:47:41 +00:00
e5be737236
* bio auth mac fix * remove comment and change duration from 2 to 0 * cherry pick previous changes * workaround for secure storage bug on mac * bump version to 3.19.5 (because breez will need this version anyways) * some code cleanup * some changess didn't get saved * just documenting the issue [skip ci] * undo accidental removal + minor code cleanup * merge conflicts * Minor UI change [skip ci] --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
32 lines
1.2 KiB
Dart
32 lines
1.2 KiB
Dart
import 'package:cake_wallet/core/secure_storage.dart';
|
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
|
import 'package:cake_wallet/entities/secret_store_key.dart';
|
|
import 'package:cake_wallet/entities/encrypt.dart';
|
|
|
|
class KeyService {
|
|
KeyService(this._secureStorage);
|
|
|
|
final FlutterSecureStorage _secureStorage;
|
|
|
|
Future<String> getWalletPassword({required String walletName}) async {
|
|
final key = generateStoreKeyFor(
|
|
key: SecretStoreKey.moneroWalletPassword, walletName: walletName);
|
|
final encodedPassword = await readSecureStorage(_secureStorage, key);
|
|
return decodeWalletPassword(password: encodedPassword!);
|
|
}
|
|
|
|
Future<void> saveWalletPassword({required String walletName, required String password}) async {
|
|
final key = generateStoreKeyFor(
|
|
key: SecretStoreKey.moneroWalletPassword, walletName: walletName);
|
|
final encodedPassword = encodeWalletPassword(password: password);
|
|
|
|
await writeSecureStorage(_secureStorage, key: key, value: encodedPassword);
|
|
}
|
|
|
|
Future<void> deleteWalletPassword({required String walletName}) async {
|
|
final key = generateStoreKeyFor(
|
|
key: SecretStoreKey.moneroWalletPassword, walletName: walletName);
|
|
|
|
await _secureStorage.delete(key: key);
|
|
}
|
|
}
|