unified code verification service
This commit is contained in:
@@ -11,13 +11,11 @@ class PendingLoginResponse {
|
||||
final AccountResponse account;
|
||||
final TokenData pendingToken;
|
||||
final String destination;
|
||||
final int ttlSeconds;
|
||||
|
||||
const PendingLoginResponse({
|
||||
required this.account,
|
||||
required this.pendingToken,
|
||||
required this.destination,
|
||||
required this.ttlSeconds,
|
||||
});
|
||||
|
||||
factory PendingLoginResponse.fromJson(Map<String, dynamic> json) => _$PendingLoginResponseFromJson(json);
|
||||
|
||||
@@ -1,27 +1,29 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'confirmation.g.dart';
|
||||
part 'response.g.dart';
|
||||
|
||||
|
||||
@JsonSerializable()
|
||||
class ConfirmationResponse {
|
||||
class VerificationResponse {
|
||||
@JsonKey(name: 'ttl_seconds', defaultValue: 0)
|
||||
final int ttlSeconds;
|
||||
@JsonKey(name: 'cooldown_seconds', defaultValue: 0)
|
||||
final int cooldownSeconds;
|
||||
@JsonKey(defaultValue: '')
|
||||
final String destination;
|
||||
final String idempotencyKey;
|
||||
|
||||
const ConfirmationResponse({
|
||||
const VerificationResponse({
|
||||
required this.ttlSeconds,
|
||||
required this.cooldownSeconds,
|
||||
required this.destination,
|
||||
required this.idempotencyKey,
|
||||
});
|
||||
|
||||
Duration get cooldownDuration => Duration(seconds: cooldownSeconds);
|
||||
Duration get ttlDuration => Duration(seconds: ttlSeconds);
|
||||
|
||||
factory ConfirmationResponse.fromJson(Map<String, dynamic> json) => _$ConfirmationResponseFromJson(json);
|
||||
factory VerificationResponse.fromJson(Map<String, dynamic> json) => _$VerificationResponseFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$ConfirmationResponseToJson(this);
|
||||
Map<String, dynamic> toJson() => _$VerificationResponseToJson(this);
|
||||
}
|
||||
Reference in New Issue
Block a user