pacman_key/lib.rs
1//! Native Rust bindings for managing the pacman keyring on Arch Linux.
2//!
3//! This crate provides a structured API for interacting with `pacman-key`,
4//! parsing GPG output to return Rust types.
5//!
6//! # Example
7//!
8//! ```no_run
9//! use pacman_key::Keyring;
10//!
11//! #[tokio::main]
12//! async fn main() -> pacman_key::Result<()> {
13//! let keyring = Keyring::new();
14//!
15//! let keys = keyring.list_keys().await?;
16//! for key in keys {
17//! println!("{}: {}", &key.fingerprint[..16], key.uid);
18//! }
19//!
20//! Ok(())
21//! }
22//! ```
23//!
24//! # Subprocesses
25//!
26//! Each operation runs its subprocesses in a new process group, which is
27//! killed with SIGKILL on timeout, on cancellation, when the operation's
28//! future is dropped, or when the calling process terminates. Terminal signals
29//! such as Ctrl-C do not reach that group directly. A killed gpg can leave
30//! stale lock files in the keyring directory; they do not block later runs.
31//!
32//! # Requirements
33//!
34//! - Arch Linux with `pacman-key` available
35//! - Root access for write operations (init, populate, sign, delete)
36//! - Read access to `/etc/pacman.d/gnupg` for list operations
37
38mod error;
39mod keyring;
40mod parse;
41mod process;
42mod types;
43mod validation;
44
45pub use error::{Error, Result};
46pub use keyring::{Keyring, ReadOnlyKeyring};
47pub use types::{
48 CancellationToken, InitializationStatus, Key, KeyType, KeyUsage, KeyValidity, OperationOptions,
49 OwnerTrust, RefreshProgress, SigStatus, Signature, Subkey, VerifyResult,
50};