diff --git a/src/cccid.rs b/src/cccid.rs index 332c4157..3d81da26 100644 --- a/src/cccid.rs +++ b/src/cccid.rs @@ -100,7 +100,6 @@ impl CccId { /// Set Cardholder Capability Container (CCC) ID #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn set(&self, yubikey: &mut YubiKey) -> Result<()> { let mut buf = CCC_TMPL.to_vec(); buf[0..self.0.len()].copy_from_slice(&self.0); diff --git a/src/certificate.rs b/src/certificate.rs index 4922613a..52fee63b 100644 --- a/src/certificate.rs +++ b/src/certificate.rs @@ -153,7 +153,6 @@ impl Certificate { /// Delete a certificate located at the given slot of the given YubiKey #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn delete(yubikey: &mut YubiKey, slot: SlotId) -> Result<()> { let txn = yubikey.begin_transaction()?; write_certificate(&txn, slot, None, CertInfo::Uncompressed) diff --git a/src/chuid.rs b/src/chuid.rs index 1b36c966..5b6390ae 100644 --- a/src/chuid.rs +++ b/src/chuid.rs @@ -116,7 +116,6 @@ impl ChuId { /// Set Cardholder Unique Identifier (CHUID) #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn set(&self, yubikey: &mut YubiKey) -> Result<()> { let mut buf = CHUID_TMPL.to_vec(); buf[..Self::BYTE_SIZE].copy_from_slice(&self.0); diff --git a/src/lib.rs b/src/lib.rs index 571712ee..400734fe 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,7 +2,7 @@ #![doc( html_logo_url = "https://raw.githubusercontent.com/iqlusioninc/yubikey.rs/main/img/logo-sq.png" )] -#![cfg_attr(docsrs, feature(doc_cfg))] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![forbid(unsafe_code)] #![warn(missing_docs, rust_2018_idioms, trivial_casts, unused_qualifications)] diff --git a/src/metadata.rs b/src/metadata.rs index b22b9782..10ae9abe 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -88,7 +88,6 @@ impl Metadata { /// Write metadata #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub(crate) fn write(&self, txn: &Transaction<'_>) -> Result<()> { if self.inner.len() > CB_OBJ_MAX - CB_OBJ_TAG_MAX { return Err(Error::GenericError); @@ -106,7 +105,6 @@ impl Metadata { /// Delete metadata #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub(crate) fn delete(txn: &Transaction<'_>) -> Result<()> { txn.save_object(T::obj_id(), &[]) } @@ -130,7 +128,6 @@ impl Metadata { /// Set metadata item #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub(crate) fn set_item(&mut self, tag: u8, item: &[u8]) -> Result<()> { let mut cb_temp: usize = 0; let mut tag_temp: u8 = 0; diff --git a/src/mgm.rs b/src/mgm.rs index a6ff1dfe..c8f41918 100644 --- a/src/mgm.rs +++ b/src/mgm.rs @@ -128,7 +128,6 @@ impl MgmKey { /// Get derived management key (MGM) #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn get_derived(yubikey: &mut YubiKey, pin: &[u8]) -> Result { let txn = yubikey.begin_transaction()?; @@ -153,7 +152,6 @@ impl MgmKey { /// Get protected management key (MGM) #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn get_protected(yubikey: &mut YubiKey) -> Result { let txn = yubikey.begin_transaction()?; @@ -184,7 +182,6 @@ impl MgmKey { /// /// This will wipe any metadata related to derived and PIN-protected management keys. #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn set_default(yubikey: &mut YubiKey) -> Result<()> { MgmKey::default().set_manual(yubikey, false) } @@ -196,7 +193,6 @@ impl MgmKey { /// /// This will wipe any metadata related to derived and PIN-protected management keys. #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn set_manual(&self, yubikey: &mut YubiKey, require_touch: bool) -> Result<()> { let txn = yubikey.begin_transaction()?; @@ -256,7 +252,6 @@ impl MgmKey { /// /// This enables key management operations to be performed with access to the PIN. #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn set_protected(&self, yubikey: &mut YubiKey) -> Result<()> { let txn = yubikey.begin_transaction()?; diff --git a/src/mscmap.rs b/src/mscmap.rs index e9ff3d93..bea06ee7 100644 --- a/src/mscmap.rs +++ b/src/mscmap.rs @@ -41,7 +41,6 @@ const TAG_MSCMAP: u8 = 0x81; /// /// Defined in Microsoft's Smart Card Minidriver Specification: /// -#[cfg_attr(docsrs, doc(cfg(feature = "untested")))] #[derive(Clone, Debug)] pub struct MsContainer { /// Container name. diff --git a/src/msroots.rs b/src/msroots.rs index a15b0d09..d1718f4a 100644 --- a/src/msroots.rs +++ b/src/msroots.rs @@ -57,7 +57,6 @@ const TAG_MSROOTS_MID: u8 = 0x83; /// /// For more information, see: /// -#[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub struct MsRoots(Vec); impl MsRoots { diff --git a/src/piv.rs b/src/piv.rs index a035179c..91bfb7c7 100644 --- a/src/piv.rs +++ b/src/piv.rs @@ -521,7 +521,6 @@ impl AlgorithmId { } #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] fn get_elem_len(self) -> usize { match self { AlgorithmId::Rsa1024 => 64, @@ -532,7 +531,6 @@ impl AlgorithmId { } #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] fn get_param_tag(self) -> u8 { match self { AlgorithmId::Rsa1024 | AlgorithmId::Rsa2048 => 0x01, @@ -703,7 +701,6 @@ pub fn generate( } #[cfg(feature = "untested")] -#[cfg_attr(docsrs, doc(cfg(feature = "untested")))] fn write_key( yubikey: &mut YubiKey, slot: SlotId, @@ -752,7 +749,6 @@ fn write_key( /// The key data that makes up an RSA key. #[cfg(feature = "untested")] -#[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub struct RsaKeyData { /// The secret prime `p`. p: Buffer, @@ -814,7 +810,6 @@ impl RsaKeyData { /// /// Errors if `algorithm` isn't `AlgorithmId::Rsa1024` or `AlgorithmId::Rsa2048`. #[cfg(feature = "untested")] -#[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn import_rsa_key( yubikey: &mut YubiKey, slot: SlotId, @@ -849,7 +844,6 @@ pub fn import_rsa_key( /// /// Errors if `algorithm` isn't `AlgorithmId::EccP256` or ` AlgorithmId::EccP384`. #[cfg(feature = "untested")] -#[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn import_ecc_key( yubikey: &mut YubiKey, slot: SlotId, @@ -878,7 +872,6 @@ pub fn import_ecc_key( /// /// #[cfg(feature = "untested")] -#[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn attest(yubikey: &mut YubiKey, key: SlotId) -> Result { let templ = [0, Ins::Attest.code(), key.into(), 0]; let txn = yubikey.begin_transaction()?; @@ -914,7 +907,6 @@ pub fn sign_data( /// Decrypt data using a PIV key. #[cfg(feature = "untested")] -#[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn decrypt_data( yubikey: &mut YubiKey, input: &[u8], diff --git a/src/yubikey.rs b/src/yubikey.rs index 2c368005..60516750 100644 --- a/src/yubikey.rs +++ b/src/yubikey.rs @@ -260,7 +260,6 @@ impl YubiKey { /// Reconnect to a YubiKey. #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn reconnect(&mut self) -> Result<()> { info!("trying to reconnect to current reader"); @@ -414,7 +413,6 @@ impl YubiKey { /// Deauthenticate. #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn deauthenticate(&mut self) -> Result<()> { let txn = self.begin_transaction()?; @@ -473,7 +471,6 @@ impl YubiKey { /// Set the number of PIN retries. #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn set_pin_retries(&mut self, pin_tries: u8, puk_tries: u8) -> Result<()> { // Special case: if either retry count is 0, it's a successful no-op if pin_tries == 0 || puk_tries == 0 { @@ -498,7 +495,6 @@ impl YubiKey { /// /// The default PIN code is `123456`. #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn change_pin(&mut self, current_pin: &[u8], new_pin: &[u8]) -> Result<()> { { let txn = self.begin_transaction()?; @@ -514,7 +510,6 @@ impl YubiKey { /// Set PIN last changed. #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn set_pin_last_changed(yubikey: &mut YubiKey) -> Result<()> { let txn = yubikey.begin_transaction()?; @@ -550,7 +545,6 @@ impl YubiKey { /// /// The default PUK code is `12345678`. #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn change_puk(&mut self, current_puk: &[u8], new_puk: &[u8]) -> Result<()> { let txn = self.begin_transaction()?; txn.change_ref(ChangeRefAction::ChangePuk, current_puk, new_puk) @@ -558,7 +552,6 @@ impl YubiKey { /// Block PUK: permanently prevent the PIN from becoming unblocked. #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn block_puk(&mut self) -> Result<()> { let mut puk = [0x30, 0x42, 0x41, 0x44, 0x46, 0x30, 0x30, 0x44]; let mut tries_remaining: i32 = -1; @@ -622,7 +615,6 @@ impl YubiKey { /// Unblock a Personal Identification Number (PIN) using a previously /// configured PIN Unblocking Key (PUK). #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn unblock_pin(&mut self, puk: &[u8], new_pin: &[u8]) -> Result<()> { let txn = self.begin_transaction()?; txn.change_ref(ChangeRefAction::UnblockPin, puk, new_pin) @@ -630,7 +622,6 @@ impl YubiKey { /// Fetch an object from the YubiKey. #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn fetch_object(&mut self, object_id: ObjectId) -> Result { let txn = self.begin_transaction()?; txn.fetch_object(object_id) @@ -638,7 +629,6 @@ impl YubiKey { /// Save an object. #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn save_object(&mut self, object_id: ObjectId, indata: &mut [u8]) -> Result<()> { let txn = self.begin_transaction()?; txn.save_object(object_id, indata) @@ -646,7 +636,6 @@ impl YubiKey { /// Get an auth challenge. #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn get_auth_challenge(&mut self) -> Result<[u8; 8]> { let txn = self.begin_transaction()?; @@ -664,7 +653,6 @@ impl YubiKey { /// Verify an auth response. #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn verify_auth_response(&mut self, response: [u8; 8]) -> Result<()> { let mut data = [0u8; 12]; data[0] = 0x7c; @@ -695,7 +683,6 @@ impl YubiKey { /// /// The reset function is only available when both pins are blocked. #[cfg(feature = "untested")] - #[cfg_attr(docsrs, doc(cfg(feature = "untested")))] pub fn reset_device(&mut self) -> Result<()> { let templ = [0, Ins::Reset.code(), 0, 0]; let txn = self.begin_transaction()?;