TF-886 Add encryption cipher for token oidc in hive database

This commit is contained in:
dab246
2022-09-07 10:40:25 +07:00
committed by Dat H. Pham
parent 6018cd383a
commit e255ea0b61
@@ -98,10 +98,14 @@ class TokenOidcCacheClient extends HiveCacheClient<TokenOidcCache> {
@override @override
Future<Box<TokenOidcCache>> openBox() async { Future<Box<TokenOidcCache>> openBox() async {
if (Hive.isBoxOpen(tableName)) { return Future.sync(() async {
return Hive.box<TokenOidcCache>(tableName); final encryptionKey = await getEncryptionKey();
} return Hive.openBox<TokenOidcCache>(
return Hive.openBox<TokenOidcCache>(tableName); tableName,
encryptionCipher: HiveAesCipher(encryptionKey!));
}).catchError((error) {
throw error;
});
} }
@override @override