Flutter Android login vault: local DB (id+base64 content), email/Google auth, dashboard search/edit/swipe-delete, dark/system theme, minSdk 29

This commit is contained in:
cania
2026-08-12 11:41:20 +02:00
commit a8791a5b10
138 changed files with 6285 additions and 0 deletions

29
lib/encryptor.dart Normal file
View File

@@ -0,0 +1,29 @@
import 'dart:convert';
import 'package:login_vault_app/constants.dart';
/// XOR cipher keyed by [AppConstants.encryptionKey], then base64-encoded.
///
/// Operates on raw bytes so any Unicode content round-trips correctly.
class Encryptor {
static List<int> _xorBytes(List<int> input, List<int> key) {
final out = List<int>.filled(input.length, 0);
for (var i = 0; i < input.length; i++) {
out[i] = input[i] ^ key[i % key.length];
}
return out;
}
/// Encrypt [plain] -> base64 string using the constant key.
static String encrypt(String plain) {
final keyBytes = utf8.encode(AppConstants.encryptionKey);
final xored = _xorBytes(utf8.encode(plain), keyBytes);
return base64.encode(xored);
}
/// Decrypt a base64 [cipher] produced by [encrypt].
static String decrypt(String cipher) {
final keyBytes = utf8.encode(AppConstants.encryptionKey);
final xored = _xorBytes(base64.decode(cipher), keyBytes);
return utf8.decode(xored);
}
}