Skip to main content

Crate pacman_key

Crate pacman_key 

Source
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-key available
  • Root access for write operations (init, populate, sign, delete)
  • Read access to /etc/pacman.d/gnupg for list operations

Structs§

CancellationToken
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.
OperationOptions
Options for long-running operations like init, populate, and refresh.
ReadOnlyKeyring
Read-only interface for querying a GPG keyring.
Signature
A signature on a key.
Subkey
A subkey attached to a primary key.
VerifyResult
Result of verifying a signature with ReadOnlyKeyring::verify_signature.

Enums§

Error
InitializationStatus
Status of keyring initialization.
KeyValidity
GPG key validity level.
OwnerTrust
GPG owner trust level (how much the key owner is trusted to sign other keys).
RefreshProgress
Progress updates during key refresh operations.
SigStatus
Verification status of a signature, from GPG’s --check-sigs output.

Type Aliases§

Result