import 'dart:developer';

import 'package:flutter_secure_storage/flutter_secure_storage.dart';

class SecureStorage {
  final FlutterSecureStorage storage = const FlutterSecureStorage();

  writeSecureData(String key, String value) async {
    await storage.write(key: key, value: value);
    log('Data writed to secure storage: $key $value');
    //print('Data writed to secure storage: $key $value');
  }

  Future<String> readSecureData(String key) async {
    log('Data start read from secure storage: $key');
    String value = await storage.read(key: key) ?? 'No data found!';
    log('Data read from secure storage: $value');
    //print('Data read from secure storage: $value');
    return value;
  }
  Future<bool> checkContainsKey(String key) async {
    bool value = await storage.containsKey(key: key);
    log('Key $key checked: $value');
    //print('Key $key checked: $value');
    return value;
  }
  deleteSecureData(String key) async {
    await storage.delete(key: key);
    log('Data deleted from secure storage: $key');
    //print('Data deleted from secure storage: $key');
  }
}