stack_wallet/lib/providers/global/secure_store_provider.dart

29 lines
956 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';
import 'package:stackwallet/providers/desktop/storage_crypto_handler_provider.dart';
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
import 'package:stackwallet/utilities/util.dart';
final secureStoreProvider = Provider<SecureStorageInterface>((ref) {
2022-11-09 22:43:26 +00:00
if (Util.isDesktop) {
final handler = ref.read(storageCryptoHandlerProvider).handler;
return SecureStorageWrapper(
store: DesktopSecureStore(handler), isDesktop: true);
2022-11-09 22:43:26 +00:00
} else {
return const SecureStorageWrapper(
store: FlutterSecureStorage(),
isDesktop: false,
);
}
});