Implements KTO-01 criteria 1-4, 10 and 11 (client part). Refs #1 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
19 lines
676 B
Dart
19 lines
676 B
Dart
import 'package:shuffle/features/auth/domain/email_link_type.dart';
|
|
|
|
/// Parameters of a mail link `/auth/confirm?token_hash=…&type=…`.
|
|
class EmailLinkRequest {
|
|
const EmailLinkRequest({required this.tokenHash, required this.type});
|
|
|
|
final String tokenHash;
|
|
final EmailLinkType type;
|
|
|
|
/// `null` if the token is missing or the type is unknown.
|
|
static EmailLinkRequest? tryParse(String? tokenHash, String? type) {
|
|
final parsedType = EmailLinkType.tryParse(type);
|
|
final token = tokenHash?.trim();
|
|
if (token == null || token.isEmpty || parsedType == null) {
|
|
return null;
|
|
}
|
|
return EmailLinkRequest(tokenHash: token, type: parsedType);
|
|
}
|
|
}
|