2022-03-15 19:16:14 +03:00
|
|
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
|
|
|
|
part 'models.freezed.dart';
|
|
|
|
part 'models.g.dart';
|
|
|
|
|
2022-03-17 22:10:10 +03:00
|
|
|
enum InteractionEvent { remove, insert, touch }
|
|
|
|
|
2022-03-22 16:23:12 +03:00
|
|
|
enum SubPage { main, fingerprints, credentials }
|
|
|
|
|
2022-03-15 19:16:14 +03:00
|
|
|
@freezed
|
|
|
|
class FidoState with _$FidoState {
|
|
|
|
const FidoState._();
|
|
|
|
|
|
|
|
factory FidoState({
|
|
|
|
required Map<String, dynamic> info,
|
|
|
|
required bool locked,
|
|
|
|
}) = _FidoState;
|
|
|
|
|
|
|
|
factory FidoState.fromJson(Map<String, dynamic> json) =>
|
|
|
|
_$FidoStateFromJson(json);
|
|
|
|
|
|
|
|
bool get hasPin => info['options']['clientPin'] == true;
|
2022-03-17 15:06:48 +03:00
|
|
|
|
|
|
|
int get minPinLength => info['min_pin_length'] as int;
|
|
|
|
|
|
|
|
bool get credMgmt =>
|
|
|
|
info['options']['credMgmt'] == true ||
|
|
|
|
info['options']['credentialMgmtPreview'] == true;
|
|
|
|
|
|
|
|
bool? get bioEnroll => info['options']['bioEnroll'];
|
|
|
|
}
|
|
|
|
|
|
|
|
@freezed
|
|
|
|
class PinResult with _$PinResult {
|
2022-03-22 16:23:12 +03:00
|
|
|
factory PinResult.success() = _PinSuccess;
|
|
|
|
factory PinResult.failed(int retries, bool authBlocked) = _PinFailure;
|
|
|
|
}
|
|
|
|
|
|
|
|
@freezed
|
|
|
|
class Fingerprint with _$Fingerprint {
|
|
|
|
factory Fingerprint(String id, String? label) = _Fingerprint;
|
|
|
|
}
|
|
|
|
|
|
|
|
@freezed
|
|
|
|
class FingerprintEvent with _$FingerprintEvent {
|
|
|
|
factory FingerprintEvent.capture(int remaining) = _EventCapture;
|
|
|
|
factory FingerprintEvent.complete(String termplateId) = _EventComplete;
|
|
|
|
factory FingerprintEvent.error(int code) = _EventError;
|
|
|
|
}
|
|
|
|
|
|
|
|
@freezed
|
|
|
|
class FidoCredential with _$FidoCredential {
|
|
|
|
factory FidoCredential(String rpId, String credentialId, String userName) =
|
|
|
|
_FidoCredential;
|
2022-03-15 19:16:14 +03:00
|
|
|
}
|