import '../security/secret_store.dart'; /// Remembers when the last automatic backup ran, so the app only makes a fresh /// copy once the interval has elapsed. Backed by the OS keystore (via /// [SecretStore]) to honour the "no plaintext at rest" rule — mirrors /// [OnboardingStore]; there is no shared_preferences here. class AutoBackupStore { AutoBackupStore(this._store); final SecretStore _store; static const _lastKey = 'tane.auto_backup.last'; /// When the last automatic backup succeeded, or null if none has run yet. Future lastBackupAt() async { final raw = await _store.read(_lastKey); if (raw == null) return null; return DateTime.tryParse(raw); } /// Records that an automatic backup succeeded at [when]. Future markBackupAt(DateTime when) => _store.write(_lastKey, when.toIso8601String()); }