Skip to content

Commit faed716

Browse files
committed
Merge PR #1398
2 parents 5cbe5c1 + 675eba0 commit faed716

File tree

5 files changed

+19
-10
lines changed

5 files changed

+19
-10
lines changed

NEWS

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

helper/helper/fido.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,11 @@ def _prepare_reset_nfc(device, event, signal):
124124
removed = False
125125
while not event.wait(0.5):
126126
try:
127-
with dev.open_connection(FidoConnection):
128-
if removed:
129-
sleep(1.0) # Wait for the device to settle
130-
return dev.open_connection(FidoConnection)
127+
conn = dev.open_connection(FidoConnection)
128+
if removed:
129+
sleep(1.0) # Wait for the device to settle
130+
return conn
131+
conn.close()
131132
except CardConnectionException:
132133
pass # Expected, ignore
133134
except NoCardException:

lib/app/views/reset_dialog.dart

+11-4
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,19 @@ class _ResetDialogState extends ConsumerState<ResetDialog> {
6868
StreamSubscription<InteractionEvent>? _subscription;
6969
InteractionEvent? _interaction;
7070
int _currentStep = -1;
71-
final _totalSteps = 3;
71+
late final int _totalSteps;
72+
73+
@override
74+
void initState() {
75+
super.initState();
76+
final nfc = widget.data.node.transport == Transport.nfc;
77+
_totalSteps = nfc ? 2 : 3;
78+
}
7279

7380
String _getMessage() {
7481
final l10n = AppLocalizations.of(context)!;
7582
final nfc = widget.data.node.transport == Transport.nfc;
76-
if (_currentStep == 3) {
83+
if (_currentStep == _totalSteps) {
7784
return l10n.l_fido_app_reset;
7885
}
7986
return switch (_interaction) {
@@ -104,7 +111,7 @@ class _ResetDialogState extends ConsumerState<ResetDialog> {
104111
title: Text(l10n.s_factory_reset),
105112
key: factoryResetCancel,
106113
onCancel: switch (_application) {
107-
Capability.fido2 => _currentStep < 3
114+
Capability.fido2 => _currentStep < _totalSteps
108115
? () {
109116
_currentStep = -1;
110117
_subscription?.cancel();
@@ -113,7 +120,7 @@ class _ResetDialogState extends ConsumerState<ResetDialog> {
113120
_ => null,
114121
},
115122
actions: [
116-
if (_currentStep < 3)
123+
if (_currentStep < _totalSteps)
117124
TextButton(
118125
onPressed: switch (_application) {
119126
Capability.fido2 => _subscription == null

lib/version.dart

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
1818

1919
# This field is updated by running ./set-version.py <version>
2020
# DO NOT MANUALLY EDIT THIS!
21-
version: 6.4.0+60400
21+
version: 6.4.0+60401
2222

2323
environment:
2424
sdk: '>=3.0.0 <4.0.0'

0 commit comments

Comments
 (0)