focus-flow/packages/scheduler_backup/lib/src/encrypted_backup.dart

33 lines
1.2 KiB
Dart

/// Implements Encrypted Backup behavior for the Scheduler Backup package.
library;
import 'dart:convert';
import 'dart:io';
import 'dart:math';
import 'dart:typed_data';
import 'package:cryptography/cryptography.dart';
part 'encrypted_backup/errors/backup_decryption_exception.dart';
part 'encrypted_backup/codec/backup_encryption_codec.dart';
part 'encrypted_backup/errors/backup_exception.dart';
part 'encrypted_backup/paths/backup_file_names.dart';
part 'encrypted_backup/paths/backup_paths.dart';
part 'encrypted_backup/operations/encrypted_backup_operations.dart';
/// Default scheduler data directory name under the user's home directory.
const defaultSchedulerDirectoryName = 'ADHD_Scheduler';
/// Default SQLite database file name used by local scheduler persistence.
const defaultSchedulerDatabaseFileName = 'scheduler.sqlite';
/// Default encrypted backup directory name under the scheduler data directory.
const defaultSchedulerBackupDirectoryName = 'backups';
const _formatMagic = 'ADHD_SCHEDULER_BACKUP_V1';
const _fileExtension = '.db.enc';
const _kdfIterations = 200000;
const _saltLength = 16;
const _nonceLength = 12;
const _keyLength = 32;
final _utf8 = utf8.encoder;