Skip to content

Commit

Permalink
fix(#445): WIP reenable flutter_secure_storage for iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
jannis-baum committed Sep 28, 2022
1 parent 19780e2 commit 852561c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
28 changes: 15 additions & 13 deletions app/lib/common/utilities/hive_utils.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
// import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'dart:convert';

import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:hive/hive.dart';

Future<List<int>> retrieveExistingOrGenerateKey() async {
return List.filled(32, 0);
// const secureStorage = FlutterSecureStorage();
const secureStorage = FlutterSecureStorage();
// if key not exists return null
// final encryprionKey = await secureStorage.read(key: 'key');
// if (encryprionKey == null) {
// final key = Hive.generateSecureKey();
// await secureStorage.write(
// key: 'key',
// value: base64UrlEncode(key),
// );
// }
// final key = Hive.generateSecureKey();// await secureStorage.read(key: 'key');
// return key; // base64Url.decode(key);
final encryprionKey = await secureStorage.read(key: 'key');
if (encryprionKey == null) {
final key = Hive.generateSecureKey();
await secureStorage.write(
key: 'key',
value: base64UrlEncode(key),
);
}
final key = await secureStorage.read(key: 'key');
return base64Url.decode(key!);
}
2 changes: 1 addition & 1 deletion app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies:
flutter_hooks: ^0.18.5+1
flutter_localizations:
sdk: flutter
# flutter_secure_storage: ^5.0.2
flutter_secure_storage: ^5.0.2
flutter_share: ^2.0.0
flutter_sliding_up_panel: ^2.0.1
flutter_svg: ^1.1.1
Expand Down

0 comments on commit 852561c

Please sign in to comment.