mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-22 08:22:16 +03:00
Add resetBlocked to DeviceInfo
This commit is contained in:
parent
3e21ad516b
commit
4f0345d8a7
@ -57,6 +57,8 @@ data class Info(
|
||||
val fipsCapable: Int,
|
||||
@SerialName("fips_approved")
|
||||
val fipsApproved: Int,
|
||||
@SerialName("reset_blocked")
|
||||
val resetBlocked: Int,
|
||||
) {
|
||||
constructor(name: String, isNfc: Boolean, usbPid: Int?, deviceInfo: DeviceInfo) : this(
|
||||
config = Config(deviceInfo.config),
|
||||
@ -79,6 +81,7 @@ data class Info(
|
||||
usb = deviceInfo.capabilitiesFor(Transport.USB),
|
||||
),
|
||||
fipsCapable = deviceInfo.fipsCapable,
|
||||
fipsApproved = deviceInfo.fipsApproved
|
||||
fipsApproved = deviceInfo.fipsApproved,
|
||||
resetBlocked = deviceInfo.resetBlocked,
|
||||
)
|
||||
}
|
||||
|
@ -23,7 +23,8 @@ val UnknownDevice = Info(
|
||||
pinComplexity = false,
|
||||
supportedCapabilities = Capabilities(),
|
||||
fipsCapable = 0,
|
||||
fipsApproved = 0
|
||||
fipsApproved = 0,
|
||||
resetBlocked = 0
|
||||
)
|
||||
|
||||
fun unknownDeviceWithCapability(transport: Transport, bit: Int = 0) : Info {
|
||||
|
@ -77,7 +77,8 @@ class SkyHelper(private val compatUtil: CompatUtil) {
|
||||
pinComplexity = false,
|
||||
supportedCapabilities = Capabilities(usb = 0),
|
||||
fipsCapable = 0,
|
||||
fipsApproved = 0
|
||||
fipsApproved = 0,
|
||||
resetBlocked = 0
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -224,10 +224,12 @@ final _desktopDeviceDataProvider =
|
||||
ref.watch(rpcProvider).valueOrNull,
|
||||
ref.watch(currentDeviceProvider),
|
||||
);
|
||||
if (notifier._deviceNode is NfcReaderNode) {
|
||||
ref.listen<WindowState>(windowStateProvider, (_, windowState) {
|
||||
notifier._notifyWindowState(windowState);
|
||||
}, fireImmediately: true);
|
||||
ref.listen<WindowState>(windowStateProvider, (_, windowState) {
|
||||
notifier._notifyWindowState(windowState);
|
||||
});
|
||||
if (notifier._deviceNode is NfcReaderNode &&
|
||||
ref.read(windowStateProvider).active) {
|
||||
notifier._pollCard();
|
||||
}
|
||||
return notifier;
|
||||
});
|
||||
@ -275,7 +277,7 @@ class CurrentDeviceDataNotifier extends StateNotifier<AsyncValue<YubiKeyData>> {
|
||||
|
||||
void _notifyWindowState(WindowState windowState) {
|
||||
if (windowState.active) {
|
||||
_pollCard();
|
||||
_pollDevice();
|
||||
} else {
|
||||
_pollTimer?.cancel();
|
||||
// TODO: Should we clear the key here?
|
||||
|
@ -90,6 +90,7 @@ class DeviceInfo with _$DeviceInfo {
|
||||
bool isFips,
|
||||
bool isSky,
|
||||
bool pinComplexity,
|
||||
int resetBlocked,
|
||||
int fipsCapable,
|
||||
int fipsApproved) = _DeviceInfo;
|
||||
|
||||
|
@ -246,6 +246,7 @@ mixin _$DeviceInfo {
|
||||
bool get isFips => throw _privateConstructorUsedError;
|
||||
bool get isSky => throw _privateConstructorUsedError;
|
||||
bool get pinComplexity => throw _privateConstructorUsedError;
|
||||
int get resetBlocked => throw _privateConstructorUsedError;
|
||||
int get fipsCapable => throw _privateConstructorUsedError;
|
||||
int get fipsApproved => throw _privateConstructorUsedError;
|
||||
|
||||
@ -271,6 +272,7 @@ abstract class $DeviceInfoCopyWith<$Res> {
|
||||
bool isFips,
|
||||
bool isSky,
|
||||
bool pinComplexity,
|
||||
int resetBlocked,
|
||||
int fipsCapable,
|
||||
int fipsApproved});
|
||||
|
||||
@ -300,6 +302,7 @@ class _$DeviceInfoCopyWithImpl<$Res, $Val extends DeviceInfo>
|
||||
Object? isFips = null,
|
||||
Object? isSky = null,
|
||||
Object? pinComplexity = null,
|
||||
Object? resetBlocked = null,
|
||||
Object? fipsCapable = null,
|
||||
Object? fipsApproved = null,
|
||||
}) {
|
||||
@ -340,6 +343,10 @@ class _$DeviceInfoCopyWithImpl<$Res, $Val extends DeviceInfo>
|
||||
? _value.pinComplexity
|
||||
: pinComplexity // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
resetBlocked: null == resetBlocked
|
||||
? _value.resetBlocked
|
||||
: resetBlocked // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
fipsCapable: null == fipsCapable
|
||||
? _value.fipsCapable
|
||||
: fipsCapable // ignore: cast_nullable_to_non_nullable
|
||||
@ -386,6 +393,7 @@ abstract class _$$DeviceInfoImplCopyWith<$Res>
|
||||
bool isFips,
|
||||
bool isSky,
|
||||
bool pinComplexity,
|
||||
int resetBlocked,
|
||||
int fipsCapable,
|
||||
int fipsApproved});
|
||||
|
||||
@ -415,6 +423,7 @@ class __$$DeviceInfoImplCopyWithImpl<$Res>
|
||||
Object? isFips = null,
|
||||
Object? isSky = null,
|
||||
Object? pinComplexity = null,
|
||||
Object? resetBlocked = null,
|
||||
Object? fipsCapable = null,
|
||||
Object? fipsApproved = null,
|
||||
}) {
|
||||
@ -455,6 +464,10 @@ class __$$DeviceInfoImplCopyWithImpl<$Res>
|
||||
? _value.pinComplexity
|
||||
: pinComplexity // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
null == resetBlocked
|
||||
? _value.resetBlocked
|
||||
: resetBlocked // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
null == fipsCapable
|
||||
? _value.fipsCapable
|
||||
: fipsCapable // ignore: cast_nullable_to_non_nullable
|
||||
@ -480,6 +493,7 @@ class _$DeviceInfoImpl extends _DeviceInfo {
|
||||
this.isFips,
|
||||
this.isSky,
|
||||
this.pinComplexity,
|
||||
this.resetBlocked,
|
||||
this.fipsCapable,
|
||||
this.fipsApproved)
|
||||
: _supportedCapabilities = supportedCapabilities,
|
||||
@ -514,13 +528,15 @@ class _$DeviceInfoImpl extends _DeviceInfo {
|
||||
@override
|
||||
final bool pinComplexity;
|
||||
@override
|
||||
final int resetBlocked;
|
||||
@override
|
||||
final int fipsCapable;
|
||||
@override
|
||||
final int fipsApproved;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'DeviceInfo(config: $config, serial: $serial, version: $version, formFactor: $formFactor, supportedCapabilities: $supportedCapabilities, isLocked: $isLocked, isFips: $isFips, isSky: $isSky, pinComplexity: $pinComplexity, fipsCapable: $fipsCapable, fipsApproved: $fipsApproved)';
|
||||
return 'DeviceInfo(config: $config, serial: $serial, version: $version, formFactor: $formFactor, supportedCapabilities: $supportedCapabilities, isLocked: $isLocked, isFips: $isFips, isSky: $isSky, pinComplexity: $pinComplexity, resetBlocked: $resetBlocked, fipsCapable: $fipsCapable, fipsApproved: $fipsApproved)';
|
||||
}
|
||||
|
||||
@override
|
||||
@ -541,6 +557,8 @@ class _$DeviceInfoImpl extends _DeviceInfo {
|
||||
(identical(other.isSky, isSky) || other.isSky == isSky) &&
|
||||
(identical(other.pinComplexity, pinComplexity) ||
|
||||
other.pinComplexity == pinComplexity) &&
|
||||
(identical(other.resetBlocked, resetBlocked) ||
|
||||
other.resetBlocked == resetBlocked) &&
|
||||
(identical(other.fipsCapable, fipsCapable) ||
|
||||
other.fipsCapable == fipsCapable) &&
|
||||
(identical(other.fipsApproved, fipsApproved) ||
|
||||
@ -560,6 +578,7 @@ class _$DeviceInfoImpl extends _DeviceInfo {
|
||||
isFips,
|
||||
isSky,
|
||||
pinComplexity,
|
||||
resetBlocked,
|
||||
fipsCapable,
|
||||
fipsApproved);
|
||||
|
||||
@ -588,6 +607,7 @@ abstract class _DeviceInfo extends DeviceInfo {
|
||||
final bool isFips,
|
||||
final bool isSky,
|
||||
final bool pinComplexity,
|
||||
final int resetBlocked,
|
||||
final int fipsCapable,
|
||||
final int fipsApproved) = _$DeviceInfoImpl;
|
||||
_DeviceInfo._() : super._();
|
||||
@ -614,6 +634,8 @@ abstract class _DeviceInfo extends DeviceInfo {
|
||||
@override
|
||||
bool get pinComplexity;
|
||||
@override
|
||||
int get resetBlocked;
|
||||
@override
|
||||
int get fipsCapable;
|
||||
@override
|
||||
int get fipsApproved;
|
||||
|
@ -45,6 +45,7 @@ _$DeviceInfoImpl _$$DeviceInfoImplFromJson(Map<String, dynamic> json) =>
|
||||
json['is_fips'] as bool,
|
||||
json['is_sky'] as bool,
|
||||
json['pin_complexity'] as bool,
|
||||
(json['reset_blocked'] as num).toInt(),
|
||||
(json['fips_capable'] as num).toInt(),
|
||||
(json['fips_approved'] as num).toInt(),
|
||||
);
|
||||
@ -61,6 +62,7 @@ Map<String, dynamic> _$$DeviceInfoImplToJson(_$DeviceInfoImpl instance) =>
|
||||
'is_fips': instance.isFips,
|
||||
'is_sky': instance.isSky,
|
||||
'pin_complexity': instance.pinComplexity,
|
||||
'reset_blocked': instance.resetBlocked,
|
||||
'fips_capable': instance.fipsCapable,
|
||||
'fips_approved': instance.fipsApproved,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user