stack_wallet/lib/providers/global/secure_store_provider.dart

32 lines
912 B
Dart
Raw Normal View History

2023-05-26 21:21:16 +00:00
/*
* This file is part of Stack Wallet.
*
* Copyright (c) 2023 Cypher Stack
* All Rights Reserved.
* The code is distributed under GPLv3 license, see LICENSE file for details.
* Generated by Cypher Stack on 2023-05-26
*
*/
2022-11-09 22:43:26 +00:00
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
2024-05-27 23:56:22 +00:00
import '../../utilities/flutter_secure_storage_interface.dart';
import '../../utilities/util.dart';
2024-05-27 23:56:22 +00:00
import '../desktop/storage_crypto_handler_provider.dart';
2022-11-09 22:43:26 +00:00
final secureStoreProvider = Provider<SecureStorageInterface>((ref) {
2022-11-09 22:43:26 +00:00
if (Util.isDesktop) {
final handler = ref.read(storageCryptoHandlerProvider).handler;
return SecureStorageWrapper(
2024-05-27 23:56:22 +00:00
store: DesktopSecureStore(handler),
isDesktop: true,
);
2022-11-09 22:43:26 +00:00
} else {
return const SecureStorageWrapper(
store: FlutterSecureStorage(),
isDesktop: false,
);
}
});