Expand description
Native Rust bindings for managing the pacman keyring on Arch Linux.
This crate provides a structured API for interacting with pacman-key,
parsing GPG output to return Rust types.
§Example
use pacman_key::Keyring;
#[tokio::main]
async fn main() -> pacman_key::Result<()> {
let keyring = Keyring::new();
let keys = keyring.list_keys().await?;
for key in keys {
println!("{}: {}", &key.fingerprint[..16], key.uid);
}
Ok(())
}§Subprocesses
Each operation runs its subprocesses in a new process group, which is killed with SIGKILL on timeout, on cancellation, when the operation’s future is dropped, or when the calling process terminates. Terminal signals such as Ctrl-C do not reach that group directly. A killed gpg can leave stale lock files in the keyring directory; they do not block later runs.
§Requirements
- Arch Linux with
pacman-keyavailable - Root access for write operations (init, populate, sign, delete)
- Read access to
/etc/pacman.d/gnupgfor list operations
Structs§
- Cancellation
Token - A token which can be used to signal a cancellation request to one or more tasks.
- Key
- A GPG key from the pacman keyring.
- KeyType
- The cryptographic algorithm and key size.
- KeyUsage
- Key capabilities parsed from GPG’s capability field.
- Keyring
- Interface for managing the pacman keyring.
- Operation
Options - Options for long-running operations like init, populate, and refresh.
- Read
Only Keyring - Read-only interface for querying a GPG keyring.
- Signature
- A signature on a key.
- Subkey
- A subkey attached to a primary key.
- Verify
Result - Result of verifying a signature with
ReadOnlyKeyring::verify_signature.
Enums§
- Error
- Initialization
Status - Status of keyring initialization.
- KeyValidity
- GPG key validity level.
- Owner
Trust - GPG owner trust level (how much the key owner is trusted to sign other keys).
- Refresh
Progress - Progress updates during key refresh operations.
- SigStatus
- Verification status of a signature, from GPG’s
--check-sigsoutput.