auth: use sessions

This commit is contained in:
2026-07-02 22:42:46 +02:00
parent a3069f0864
commit 2039080a92
4 changed files with 130 additions and 47 deletions
+4 -3
View File
@@ -7,7 +7,7 @@ import 'package:sheetless/core/models/config.dart';
import 'package:sheetless/core/models/sheet.dart';
/// Keys for secure storage (credentials and tokens).
enum SecureStorageKey { url, jwt, email }
enum SecureStorageKey { url, refreshToken, username }
/// Data class for storing annotations with metadata.
class StoredAnnotation {
@@ -110,7 +110,7 @@ class StorageService {
/// while preserving server URL and email for convenience.
Future<void> clearAllUserData() async {
// Clear JWT token
await writeSecure(SecureStorageKey.jwt, null);
await writeSecure(SecureStorageKey.refreshToken, null);
// Clear all Hive boxes
final sheetAccessTimesBox = await Hive.openBox(_sheetAccessTimesBox);
@@ -123,7 +123,8 @@ class StorageService {
await changeQueueBox.clear();
final annotationsBox = await Hive.openBox(_annotationsBox);
await annotationsBox.clear();
await annotationsBox
.clear(); // TODO: this can lead to a loss of important data. Make sure the user is warned
final sheetsBox = await Hive.openBox(_sheetsBox);
await sheetsBox.clear();