addFailedAttempt method

  1. @override
Future<void> addFailedAttempt(
  1. DateTime timestamp, {
  2. required UserId forUser,
})
override

Adds timestamp to the list of failed authentication attempts of user with forUser id

Implementation

@override
Future<void> addFailedAttempt(
  DateTime timestamp, {
  required UserId forUser,
}) async {
  final key = _keyListFailedAttempts(forUser).value;
  final list = sp.getStringList(key);
  if (list == null) {
    sp.setStringList(key, [timestamp.toString()]);
  } else {
    sp.setStringList(key, [...list, timestamp.toString()]);
  }
}