feat: update pgp

This commit is contained in:
2023-10-05 23:15:42 +08:00
parent 81c20a6872
commit 78824f279b
4 changed files with 14 additions and 9 deletions

View File

@@ -1,6 +1,12 @@
use openpgp_card::OpenPgp;
use openpgp_card_pcsc::PcscBackend;
use rust_util::XResult;
pub fn get_openpgp_card() -> XResult<OpenPgp> {
let card = get_card()?;
Ok(OpenPgp::new(card))
}
pub fn get_card() -> XResult<PcscBackend> {
let card_list = opt_result!(PcscBackend::cards(None), "Read OpenPGP card list failed: {}");
if card_list.is_empty() {