This commit is contained in:
fosse 2023-12-13 16:08:30 -05:00
parent 049e4def27
commit fc6be2aa97

View file

@ -185,6 +185,8 @@ Future<void> defaultSettingsMigration(
case 25:
await rewriteSecureStoragePin(secureStorage: secureStorage);
break;
case 26:
await pinEncryptionMigration(secureStorage: secureStorage);
default:
break;
}
@ -378,6 +380,31 @@ Node getMoneroDefaultNode({required Box<Node> nodes}) {
}
}
Future<void> pinEncryptionMigration({required FlutterSecureStorage secureStorage}) async {
try {
// first, get the encoded pin:
final keyForPinCode = generateStoreKeyFor(key: SecretStoreKey.pinCodePassword);
String? encodedPin;
encodedPin = await secureStorage.read(key: keyForPinCode);
// if (encodedPin == null) {
// return;
// }
// // ensure we overwrite by deleting the old key first:
// await secureStorage.delete(key: keyForPinCode);
// await secureStorage.write(
// key: keyForPinCode,
// value: encodedPin,
// iOptions: IOSOptions(accessibility: KeychainAccessibility.first_unlock),
// mOptions: MacOsOptions(accessibility: KeychainAccessibility.first_unlock),
// );
} catch (e) {
// failure isn't really an option since we'll be updating how pins are stored and used
print(e);
}
}
Future<void> rewriteSecureStoragePin({required FlutterSecureStorage secureStorage}) async {
// the bug only affects ios/mac:
if (!Platform.isIOS && !Platform.isMacOS) {