Fix FIDO reset over NFC

This commit is contained in:
Dain Nilsson 2024-02-14 12:48:57 +01:00
parent 5cbe5c1200
commit 675eba042a
No known key found for this signature in database
GPG Key ID: F04367096FBA95E8
5 changed files with 19 additions and 10 deletions

1
NEWS
View File

@ -9,6 +9,7 @@
** PIV: Add output format for public key when generating keys.
** Desktop: Window hidden/shown state no longer saved when closing the app,
use --hidden to start the app in a hidden to systray state.
** Desktop: Fix FIDO reset over NFC.
** Windows: Add option to launch Windows Settings for FIDO management.
** Android: Increase read timeout for NFC, improving compatibility with older YubiKeys.

View File

@ -124,10 +124,11 @@ class Ctap2Node(RpcNode):
removed = False
while not event.wait(0.5):
try:
with dev.open_connection(FidoConnection):
if removed:
sleep(1.0) # Wait for the device to settle
return dev.open_connection(FidoConnection)
conn = dev.open_connection(FidoConnection)
if removed:
sleep(1.0) # Wait for the device to settle
return conn
conn.close()
except CardConnectionException:
pass # Expected, ignore
except NoCardException:

View File

@ -68,12 +68,19 @@ class _ResetDialogState extends ConsumerState<ResetDialog> {
StreamSubscription<InteractionEvent>? _subscription;
InteractionEvent? _interaction;
int _currentStep = -1;
final _totalSteps = 3;
late final int _totalSteps;
@override
void initState() {
super.initState();
final nfc = widget.data.node.transport == Transport.nfc;
_totalSteps = nfc ? 2 : 3;
}
String _getMessage() {
final l10n = AppLocalizations.of(context)!;
final nfc = widget.data.node.transport == Transport.nfc;
if (_currentStep == 3) {
if (_currentStep == _totalSteps) {
return l10n.l_fido_app_reset;
}
return switch (_interaction) {
@ -104,7 +111,7 @@ class _ResetDialogState extends ConsumerState<ResetDialog> {
title: Text(l10n.s_factory_reset),
key: factoryResetCancel,
onCancel: switch (_application) {
Capability.fido2 => _currentStep < 3
Capability.fido2 => _currentStep < _totalSteps
? () {
_currentStep = -1;
_subscription?.cancel();
@ -113,7 +120,7 @@ class _ResetDialogState extends ConsumerState<ResetDialog> {
_ => null,
},
actions: [
if (_currentStep < 3)
if (_currentStep < _totalSteps)
TextButton(
onPressed: switch (_application) {
Capability.fido2 => _subscription == null

View File

@ -2,4 +2,4 @@
// This file is generated by running ./set-version.py <version> <build>
const String version = '6.4.0';
const int build = 60400;
const int build = 60401;

View File

@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# This field is updated by running ./set-version.py <version>
# DO NOT MANUALLY EDIT THIS!
version: 6.4.0+60400
version: 6.4.0+60401
environment:
sdk: '>=3.0.0 <4.0.0'