From e0c0b2ae2dae0ebd78be8b1270b83f3c97c2a47a Mon Sep 17 00:00:00 2001 From: Dain Nilsson Date: Fri, 23 Aug 2024 17:14:44 +0200 Subject: [PATCH] PIV bio additions Disable dialog buttons when busy. Show MATCH status in details view. --- lib/l10n/app_de.arb | 1 + lib/l10n/app_en.arb | 1 + lib/l10n/app_fr.arb | 1 + lib/l10n/app_ja.arb | 1 + lib/l10n/app_pl.arb | 1 + lib/piv/keys.dart | 1 + lib/piv/views/cert_info_view.dart | 11 ++++++++++- lib/piv/views/generate_key_dialog.dart | 12 +++++++----- lib/piv/views/import_file_dialog.dart | 12 +++++++----- lib/piv/views/piv_screen.dart | 1 + lib/piv/views/slot_dialog.dart | 1 + 11 files changed, 32 insertions(+), 11 deletions(-) diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index 69bd71c7..28c5a47d 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -500,6 +500,7 @@ } }, "@_fingerprints": {}, + "s_biometrics": null, "l_fingerprint": "Fingerabdruck: {label}", "@l_fingerprint": { "placeholders": { diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index e938113c..9c277ef5 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -500,6 +500,7 @@ } }, "@_fingerprints": {}, + "s_biometrics": "Biometrics", "l_fingerprint": "Fingerprint: {label}", "@l_fingerprint": { "placeholders": { diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb index 057ef137..7c0c86cb 100644 --- a/lib/l10n/app_fr.arb +++ b/lib/l10n/app_fr.arb @@ -500,6 +500,7 @@ } }, "@_fingerprints": {}, + "s_biometrics": null, "l_fingerprint": "Empreinte digitale\u00a0: {label}", "@l_fingerprint": { "placeholders": { diff --git a/lib/l10n/app_ja.arb b/lib/l10n/app_ja.arb index a8600482..9a9f680d 100644 --- a/lib/l10n/app_ja.arb +++ b/lib/l10n/app_ja.arb @@ -500,6 +500,7 @@ } }, "@_fingerprints": {}, + "s_biometrics": null, "l_fingerprint": "指紋:{label}", "@l_fingerprint": { "placeholders": { diff --git a/lib/l10n/app_pl.arb b/lib/l10n/app_pl.arb index 48ab53a5..eba4cb44 100644 --- a/lib/l10n/app_pl.arb +++ b/lib/l10n/app_pl.arb @@ -500,6 +500,7 @@ } }, "@_fingerprints": {}, + "s_biometrics": null, "l_fingerprint": "Odcisk palca: {label}", "@l_fingerprint": { "placeholders": { diff --git a/lib/piv/keys.dart b/lib/piv/keys.dart index 33293c12..f822b172 100644 --- a/lib/piv/keys.dart +++ b/lib/piv/keys.dart @@ -99,6 +99,7 @@ const appListItem95 = Key('$_prefix.95.applistitem'); // SlotMetadata body keys const slotMetadataKeyType = Key('$_prefix.slotMetadata.keyType'); +const slotMetadataBiometrics = Key('$_prefix.slotMetadata.biometrics'); // CertInfo body keys const certInfoKeyType = Key('$_prefix.certInfo.keyType'); diff --git a/lib/piv/views/cert_info_view.dart b/lib/piv/views/cert_info_view.dart index 72b1c08b..88018a19 100644 --- a/lib/piv/views/cert_info_view.dart +++ b/lib/piv/views/cert_info_view.dart @@ -28,9 +28,10 @@ class CertInfoTable extends ConsumerWidget { final CertInfo? certInfo; final SlotMetadata? metadata; final bool alwaysIncludePrivate; + final bool supportsBio; const CertInfoTable(this.certInfo, this.metadata, - {super.key, this.alwaysIncludePrivate = false}); + {super.key, this.alwaysIncludePrivate = false, this.supportsBio = false}); @override Widget build(BuildContext context, WidgetRef ref) { @@ -46,6 +47,14 @@ class CertInfoTable extends ConsumerWidget { metadata.keyType.getDisplayName(l10n), keys.slotMetadataKeyType ), + if (metadata != null && supportsBio) + l10n.s_biometrics: ( + [PinPolicy.matchAlways, PinPolicy.matchOnce] + .contains(metadata.pinPolicy) + ? l10n.s_enabled + : l10n.s_disabled, + keys.slotMetadataBiometrics + ), if (metadata == null && alwaysIncludePrivate) l10n.s_private_key: (l10n.s_none, keys.slotMetadataKeyType), if (certInfo != null) ...{ diff --git a/lib/piv/views/generate_key_dialog.dart b/lib/piv/views/generate_key_dialog.dart index 5d12de51..92630c37 100644 --- a/lib/piv/views/generate_key_dialog.dart +++ b/lib/piv/views/generate_key_dialog.dart @@ -249,11 +249,13 @@ class _GenerateKeyDialogState extends ConsumerState { FilterChip( label: Text(l10n.s_allow_fingerprint), selected: _allowMatch, - onSelected: (value) { - setState(() { - _allowMatch = value; - }); - }, + onSelected: _generating + ? null + : (value) { + setState(() { + _allowMatch = value; + }); + }, ), ]), Padding( diff --git a/lib/piv/views/import_file_dialog.dart b/lib/piv/views/import_file_dialog.dart index c328ef8d..6fc4baa8 100644 --- a/lib/piv/views/import_file_dialog.dart +++ b/lib/piv/views/import_file_dialog.dart @@ -315,11 +315,13 @@ class _ImportFileDialogState extends ConsumerState { FilterChip( label: Text(l10n.s_allow_fingerprint), selected: _allowMatch, - onSelected: (value) { - setState(() { - _allowMatch = value; - }); - }, + onSelected: _importing + ? null + : (value) { + setState(() { + _allowMatch = value; + }); + }, ), ], ] diff --git a/lib/piv/views/piv_screen.dart b/lib/piv/views/piv_screen.dart index 65c28f17..e4a8139f 100644 --- a/lib/piv/views/piv_screen.dart +++ b/lib/piv/views/piv_screen.dart @@ -158,6 +158,7 @@ class _PivScreenState extends ConsumerState { selected.metadata, alwaysIncludePrivate: pivState.supportsMetadata, + supportsBio: pivState.supportsBio, ), if (selected.certInfo == null) const SizedBox(height: 16) diff --git a/lib/piv/views/slot_dialog.dart b/lib/piv/views/slot_dialog.dart index 8b30f7aa..c1cabe4e 100644 --- a/lib/piv/views/slot_dialog.dart +++ b/lib/piv/views/slot_dialog.dart @@ -98,6 +98,7 @@ class SlotDialog extends ConsumerWidget { certInfo, metadata, alwaysIncludePrivate: pivState.supportsMetadata, + supportsBio: pivState.supportsBio, ), if (certInfo == null) const SizedBox(height: 16), ],