mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2024-11-16 13:43:17 +00:00
38 lines
735 B
Dart
38 lines
735 B
Dart
import 'dart:ui';
|
|
|
|
import 'package:crypt/crypt.dart';
|
|
import 'package:equatable/equatable.dart';
|
|
import 'package:selfprivacy/utils/color_utils.dart';
|
|
import 'package:hive/hive.dart';
|
|
import 'package:selfprivacy/utils/password_generator.dart';
|
|
|
|
part 'user.g.dart';
|
|
|
|
@HiveType(typeId: 1)
|
|
class User extends Equatable {
|
|
User({
|
|
required this.login,
|
|
required this.password,
|
|
});
|
|
|
|
@HiveField(0)
|
|
final String login;
|
|
|
|
@HiveField(1)
|
|
final String password;
|
|
|
|
@override
|
|
List<Object?> get props => [login, password];
|
|
|
|
Color get color => stringToColor(login);
|
|
|
|
Crypt get hashPassword => Crypt.sha512(
|
|
password,
|
|
salt: StringGenerators.passwordSalt(),
|
|
);
|
|
|
|
String toString() {
|
|
return login;
|
|
}
|
|
}
|