Implemented cooldown before User is able to resend confirmation code for 2fa

This commit is contained in:
Arseni
2025-12-23 14:56:47 +03:00
parent 1ed76f7243
commit ec54579921
6 changed files with 196 additions and 9 deletions

View File

@@ -0,0 +1,26 @@
import 'package:json_annotation/json_annotation.dart';
part 'confirmation.g.dart';
@JsonSerializable()
class ConfirmationResponse {
@JsonKey(name: 'ttl_seconds', defaultValue: 0)
final int ttlSeconds;
@JsonKey(name: 'cooldown_seconds', defaultValue: 0)
final int cooldownSeconds;
@JsonKey(defaultValue: '')
final String destination;
const ConfirmationResponse({
required this.ttlSeconds,
required this.cooldownSeconds,
required this.destination,
});
Duration get cooldownDuration => Duration(seconds: cooldownSeconds);
Duration get ttlDuration => Duration(seconds: ttlSeconds);
factory ConfirmationResponse.fromJson(Map<String, dynamic> json) => _$ConfirmationResponseFromJson(json);
Map<String, dynamic> toJson() => _$ConfirmationResponseToJson(this);
}