From ac04615219080caff1a0c383d1e7ee802801e84b Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Sun, 12 Feb 2023 00:04:24 +0000 Subject: [PATCH] Ignore smart cards that don't have a PIV applet Closes str4d/age-plugin-yubikey#78. --- i18n/en-US/age_plugin_yubikey.ftl | 1 + src/key.rs | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/i18n/en-US/age_plugin_yubikey.ftl b/i18n/en-US/age_plugin_yubikey.ftl index 22ad778..9129c7a 100644 --- a/i18n/en-US/age_plugin_yubikey.ftl +++ b/i18n/en-US/age_plugin_yubikey.ftl @@ -120,6 +120,7 @@ cli-setup-finished = open-yk-with-serial = ⏳ Please insert the {-yubikey} with serial {$yubikey_serial}. open-yk-without-serial = ⏳ Please insert the {-yubikey}. warn-yk-not-connected = Ignoring {$yubikey_name}: not connected +warn-yk-missing-applet = Ignoring {$yubikey_name}: Missing {$applet_name} applet print-recipient = Recipient: {$recipient} diff --git a/src/key.rs b/src/key.rs index ca23248..b942c21 100644 --- a/src/key.rs +++ b/src/key.rs @@ -49,6 +49,17 @@ pub(crate) fn filter_connected(reader: &Reader) -> bool { ); false } + Err(yubikey::Error::AppletNotFound { applet_name }) => { + warn!( + "{}", + fl!( + "warn-yk-missing-applet", + yubikey_name = reader.name(), + applet_name = applet_name, + ), + ); + false + } Err(_) => true, Ok(yubikey) => { // We only connected as a side-effect of confirming that we can connect, so