-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(#445): WIP reenable flutter_secure_storage for iOS
- Loading branch information
1 parent
19780e2
commit 852561c
Showing
2 changed files
with
16 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters