From a5b6ce468d44d1b42ada15b0759eb121b414cc2a Mon Sep 17 00:00:00 2001 From: Heiko Schaefer Date: Fri, 10 Sep 2021 17:02:04 +0200 Subject: [PATCH] Add high level crate documentation. --- openpgp-card-sequoia/src/lib.rs | 39 +++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/openpgp-card-sequoia/src/lib.rs b/openpgp-card-sequoia/src/lib.rs index 0302d5d..1522a05 100644 --- a/openpgp-card-sequoia/src/lib.rs +++ b/openpgp-card-sequoia/src/lib.rs @@ -3,6 +3,45 @@ //! A higher-level wrapper around the openpgp-card crate. //! It uses sequoia_openpgp for OpenPGP operations. +//! +//! # Backends +//! +//! To make use of this crate, you need to use a backend for communication +//! with cards. The suggested default backend is `openpgp-card-pcsc`. +//! +//! With `openpgp-card-pcsc` you can either open all available cards: +//! +//! ```no_run +//! use openpgp_card_pcsc::PcscClient; +//! use openpgp_card_sequoia::card::Open; +//! +//! # fn main() -> Result<(), Box> { +//! for card in PcscClient::cards()? { +//! let open = Open::open_card(card)?; +//! println!("Found OpenPGP card with ident '{}'", +//! open.get_application_id()?.ident()); +//! } +//! # Ok(()) +//! # } +//! ``` +//! +//! Or you can open one particular card, by ident: +//! +//! ```no_run +//! use openpgp_card_pcsc::PcscClient; +//! use openpgp_card_sequoia::card::Open; +//! +//! # fn main() -> Result<(), Box> { +//! let card = PcscClient::open_by_ident("abcd:12345678")?; +//! let open = Open::open_card(card)?; +//! # Ok(()) +//! # } +//! ``` +//! +//! # Use for cryptographic operations +//! +//! # Setting up and configuring a card +//! use openpgp::packet::{key, Key}; use sequoia_openpgp as openpgp;