diff --git a/card-functionality/src/cards.rs b/card-functionality/src/cards.rs index 4477488..c6e0271 100644 --- a/card-functionality/src/cards.rs +++ b/card-functionality/src/cards.rs @@ -97,7 +97,7 @@ impl TestCard { let res = ScdClient::shutdown_scd(None); log::trace!(" Attempt to shutdown scd: {:?}", res); - for card_client in PcscClient::list_cards()? { + for card_client in PcscClient::cards()? { let mut ca = CardApp::from(card_client); // Set Card Capabilities (chaining, command length, ..) diff --git a/openpgp-card-sequoia/src/main.rs b/openpgp-card-sequoia/src/main.rs index c8b6dc4..3634969 100644 --- a/openpgp-card-sequoia/src/main.rs +++ b/openpgp-card-sequoia/src/main.rs @@ -239,7 +239,7 @@ fn main() -> Result<(), Box> { println!("The following OpenPGP cards are connected to your system:"); - let cards = PcscClient::list_cards()?; + let cards = PcscClient::cards()?; for c in cards { let mut ca = CardApp::from(c); diff --git a/pcsc/src/lib.rs b/pcsc/src/lib.rs index 9e31c07..d47f9a0 100644 --- a/pcsc/src/lib.rs +++ b/pcsc/src/lib.rs @@ -82,7 +82,9 @@ impl PcscClient { } /// Return all cards on which the OpenPGP application could be selected. - pub fn list_cards() -> Result> { + /// + /// Each card is opened and has the OpenPGP application selected. + pub fn cards() -> Result> { let cards = Self::unopened_cards()? .into_iter() .map(Self::select) @@ -106,22 +108,6 @@ impl PcscClient { } } - /// Returns the first OpenPGP card, with the OpenPGP application selected. - /// - /// If multiple cards are connected, this will effectively be a random - /// pick. You should consider using `open_by_ident` instead. - pub fn open_yolo() -> Result { - for card in Self::unopened_cards()? { - if let Ok(ca) = Self::select(card) { - return Ok(ca.into()); - } - } - - Err(Error::Smartcard(SmartcardError::CardNotFound( - "No OpenPGP card found".to_string(), - ))) - } - /// Get application related data from the card and check if 'ident' /// matches fn match_by_ident(