import 'package:flutter_secure_storage/flutter_secure_storage.dart';

enum StorageKey { url, jwt, email, password }

class StorageHelper {
  late FlutterSecureStorage secureStorage;

  StorageHelper() {
    AndroidOptions getAndroidOptions() => const AndroidOptions(
          encryptedSharedPreferences: true,
        );
    secureStorage = FlutterSecureStorage(aOptions: getAndroidOptions());
  }

  Future<String?> read(StorageKey key) {
    return secureStorage.read(key: key.name);
  }

  Future<void> write(StorageKey key, String value) {
    return secureStorage.write(key: key.name, value: value);
  }
}
