unified code verification service

This commit is contained in:
Stephan D
2026-02-10 01:55:33 +01:00
parent 76c3bfdea9
commit 7f540671c1
120 changed files with 1863 additions and 1394 deletions

View File

@@ -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);

View File

@@ -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);
}