mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-16 19:58:54 +02:00
chore: Update dependencies, switch Flutter web renderer to HTML, replace media_kit with video_player/chewie, and remove Hive volume from Docker setup.
This commit is contained in:
1 parent
3c0d472a31
commit
0ca2835cba
16 files changed
+1282
-688
No files matched your search
@@ -94,16 +94,40 @@ class HiveService {
|
||||
}
|
||||
}
|
||||
|
||||
/// Hash password using SHA-256
|
||||
/// Hash password using SHA-256 with salt
|
||||
static String _hashPassword(String password) {
|
||||
final bytes = utf8.encode(password);
|
||||
// Generate a random salt using the first 16 chars of a UUID
|
||||
final salt = const Uuid().v4().substring(0, 16);
|
||||
final bytes = utf8.encode(password + salt);
|
||||
final digest = sha256.convert(bytes);
|
||||
return digest.toString();
|
||||
return '$salt:${digest.toString()}';
|
||||
}
|
||||
|
||||
/// Verify password against stored hash
|
||||
static bool verifyPassword(String password, String storedHash) {
|
||||
try {
|
||||
final parts = storedHash.split(':');
|
||||
if (parts.length != 2) {
|
||||
// Legacy hash without salt - fallback to direct comparison
|
||||
final legacyHash = sha256.convert(utf8.encode(password)).toString();
|
||||
return legacyHash == storedHash;
|
||||
}
|
||||
|
||||
final salt = parts[0];
|
||||
final expectedHash = parts[1];
|
||||
final bytes = utf8.encode(password + salt);
|
||||
final actualHash = sha256.convert(bytes).toString();
|
||||
|
||||
return actualHash == expectedHash;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// Public method to hash passwords (used by auth)
|
||||
static String hashPassword(String password) => _hashPassword(password);
|
||||
|
||||
|
||||
/// Get users box
|
||||
static Box<AppUser> get usersBox => Hive.box<AppUser>(_usersBoxName);
|
||||
|
||||
|
||||
Reference in new issue
Block a user