Minor doc edits

This commit is contained in:
Heiko Schaefer 2021-08-21 17:42:46 +02:00
parent d599471be5
commit 6ad4231d16
4 changed files with 11 additions and 6 deletions

View file

@ -18,7 +18,7 @@ use crate::errors::OpenpgpCardError;
use crate::tlv::{tag::Tag, Tlv, TlvEntry}; use crate::tlv::{tag::Tag, Tlv, TlvEntry};
use crate::{apdu, keys, CardCaps, CardClientBox, KeyType}; use crate::{apdu, keys, CardCaps, CardClientBox, KeyType};
/// Direct, low-level, access to OpenPGP card functionality. /// Low-level access to OpenPGP card functionality.
/// ///
/// No checks are performed here (e.g. for valid data lengths). /// No checks are performed here (e.g. for valid data lengths).
/// Such checks should be performed on a higher layer, if needed. /// Such checks should be performed on a higher layer, if needed.

View file

@ -352,6 +352,7 @@ impl<T> KeySet<T> {
} }
} }
/// nom parsing helper
pub(crate) fn complete<O>(result: nom::IResult<&[u8], O>) -> Result<O, Error> { pub(crate) fn complete<O>(result: nom::IResult<&[u8], O>) -> Result<O, Error> {
let (rem, output) = let (rem, output) =
result.map_err(|err| anyhow!("Parsing failed: {:?}", err))?; result.map_err(|err| anyhow!("Parsing failed: {:?}", err))?;

View file

@ -1,13 +1,13 @@
// SPDX-FileCopyrightText: 2021 Heiko Schaefer <heiko@schaefer.name> // SPDX-FileCopyrightText: 2021 Heiko Schaefer <heiko@schaefer.name>
// SPDX-License-Identifier: MIT OR Apache-2.0 // SPDX-License-Identifier: MIT OR Apache-2.0
//! Error types that are used by this crate. //! Error types used by this crate.
//! //!
//! [`OpenpgpCardError`] is a wrapper enum for all error types that are used. //! [`OpenpgpCardError`] is a wrapper enum for all error types that are used.
//! //!
//! The two main cases are: //! The two main classes of errors are:
//! - [`SmartcardError`], for problems on the reader/smartcard layer //! - [`SmartcardError`], for problems on the reader/smartcard layer
//! - [`OcErrorStatus`] which models error statuses reported by the OpenPGP //! - [`OcErrorStatus`], which models error statuses reported by the OpenPGP
//! card application //! card application
use thiserror::Error; use thiserror::Error;

View file

@ -41,7 +41,7 @@ pub use crate::card_app::CardApp;
/// The CardClient trait defines communication with an OpenPGP card via a /// The CardClient trait defines communication with an OpenPGP card via a
/// backend implementation (e.g. the pcsc backend in the crate /// backend implementation (e.g. the pcsc backend in the crate
/// openpgp-card-pcsc). /// [openpgp-card-pcsc](https://crates.io/crates/openpgp-card-pcsc)).
pub trait CardClient { pub trait CardClient {
/// Transmit the command data in `cmd` to the card. /// Transmit the command data in `cmd` to the card.
/// ///
@ -71,9 +71,13 @@ pub trait CardClient {
} }
} }
/// A boxed CardClient (which is Send+Sync).
pub type CardClientBox = Box<dyn CardClient + Send + Sync>; pub type CardClientBox = Box<dyn CardClient + Send + Sync>;
/// Information about the capabilities of the card. /// Configuration of the capabilities of the card.
///
/// This configuration is used to determine e.g. if chaining or extended
/// length can be used when communicating with the card.
/// ///
/// (This configuration is retrieved from card metadata, specifically from /// (This configuration is retrieved from card metadata, specifically from
/// "Card Capabilities" and "Extended length information") /// "Card Capabilities" and "Extended length information")