mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-02 12:14:09 +01:00
bio auth on mac + package updates for 3.19.3/5 (#1398)
* 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>
This commit is contained in:
co-authored by
Omar Hatem
parent
3f3cd10158
commit
e5be737236
@@ -1,32 +1,29 @@
|
||||
import 'package:local_auth/local_auth.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:flutter_local_authentication/flutter_local_authentication.dart';
|
||||
|
||||
class BiometricAuth {
|
||||
final _localAuth = LocalAuthentication();
|
||||
final _flutterLocalAuthenticationPlugin = FlutterLocalAuthentication();
|
||||
|
||||
Future<bool> isAuthenticated() async {
|
||||
try {
|
||||
return await _localAuth.authenticate(
|
||||
localizedReason: S.current.biometric_auth_reason,
|
||||
options: AuthenticationOptions(
|
||||
biometricOnly: true,
|
||||
useErrorDialogs: true,
|
||||
stickyAuth: false));
|
||||
} on PlatformException catch (e) {
|
||||
final authenticated = await _flutterLocalAuthenticationPlugin.authenticate();
|
||||
return authenticated;
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Future<bool> canCheckBiometrics() async {
|
||||
bool canAuthenticate;
|
||||
try {
|
||||
return await _localAuth.canCheckBiometrics;
|
||||
} on PlatformException catch (e) {
|
||||
print(e);
|
||||
canAuthenticate = await _flutterLocalAuthenticationPlugin.canAuthenticate();
|
||||
await _flutterLocalAuthenticationPlugin.setTouchIDAuthenticationAllowableReuseDuration(0);
|
||||
} catch (error) {
|
||||
print("Exception checking support. $error");
|
||||
canAuthenticate = false;
|
||||
}
|
||||
|
||||
return false;
|
||||
return canAuthenticate;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:io';
|
||||
import 'dart:convert';
|
||||
import 'package:cake_wallet/core/secure_storage.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
@@ -147,8 +148,8 @@ Future<void> ios_migrate_pin() async {
|
||||
|
||||
final key = generateStoreKeyFor(key: SecretStoreKey.pinCodePassword);
|
||||
final encodedPassword = encodedPinCode(pin: pinPassword);
|
||||
await flutterSecureStorage.delete(key: key);
|
||||
await flutterSecureStorage.write(key: key, value: encodedPassword);
|
||||
await writeSecureStorage(flutterSecureStorage, key: key, value: encodedPassword);
|
||||
|
||||
await prefs.setBool('ios_migration_pin_completed', true);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:cake_wallet/core/secure_storage.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:cw_core/cake_hive.dart';
|
||||
|
||||
@@ -10,8 +11,7 @@ Future<List<int>> getEncryptionKey(
|
||||
key = CakeHive.generateSecureKey();
|
||||
final keyStringified = key.join(',');
|
||||
String storageKey = 'transactionDescriptionsBoxKey';
|
||||
await secureStorage.delete(key: storageKey);
|
||||
await secureStorage.write(key: storageKey, value: keyStringified);
|
||||
await writeSecureStorage(secureStorage, key: storageKey, value: keyStringified);
|
||||
} else {
|
||||
key = stringifiedKey.split(',').map((i) => int.parse(i)).toList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user