pub struct ReadOnlyKeyring { /* private fields */ }Expand description
Read-only interface for querying a GPG keyring.
This type is returned by Keyring::with_homedir and only provides
read operations (list_keys, list_signatures). Write operations
require a Keyring which targets the system pacman keyring.
§Example
use pacman_key::Keyring;
let reader = Keyring::with_homedir("/custom/gnupg");
let keys = reader.list_keys().await?;Implementations§
Source§impl ReadOnlyKeyring
impl ReadOnlyKeyring
Sourcepub async fn list_signatures(
&self,
keyid: Option<&str>,
) -> Result<Vec<Signature>>
pub async fn list_signatures( &self, keyid: Option<&str>, ) -> Result<Vec<Signature>>
Lists signatures on keys in the keyring (non-checking --list-sigs).
If keyid is provided, lists signatures only for that key.
Otherwise lists all signatures in the keyring. The status field of
each Signature is None; use check_signatures to verify them.
Sourcepub async fn check_signatures(
&self,
keyid: Option<&str>,
) -> Result<Vec<Signature>>
pub async fn check_signatures( &self, keyid: Option<&str>, ) -> Result<Vec<Signature>>
Lists and verifies signatures on keys (--check-sigs).
Like list_signatures but each Signature’s status is populated
with the verification result.
Sourcepub async fn export_keys(&self, keyids: &[&str]) -> Result<String>
pub async fn export_keys(&self, keyids: &[&str]) -> Result<String>
Exports the given keys as an ASCII-armored block.
An empty keyids slice exports all public keys. Mirrors
pacman-key --export.
Sourcepub async fn fingerprints(&self, keyids: &[&str]) -> Result<Vec<String>>
pub async fn fingerprints(&self, keyids: &[&str]) -> Result<Vec<String>>
Returns the fingerprints of the given keys (or all keys if empty).
Mirrors pacman-key --finger. Note list_keys already returns the
same fingerprints alongside the full key data; this is a convenience
for when only fingerprints are needed.
Sourcepub async fn verify_signature(
&self,
sig: &Path,
file: Option<&Path>,
) -> Result<VerifyResult>
pub async fn verify_signature( &self, sig: &Path, file: Option<&Path>, ) -> Result<VerifyResult>
Verifies a signature against the keyring.
sig is the (binary) signature file; file is the signed data for a
detached signature (omit for an embedded one). Mirrors
pacman-key --verify, which rejects ASCII-armored signatures.
Returns a VerifyResult; a bad signature is reported via
good == false, not an error. Only an inability to run gpg or read the
signature file produces an Err.
Sourcepub async fn get_ownertrust(&self) -> Result<Vec<(String, OwnerTrust)>>
pub async fn get_ownertrust(&self) -> Result<Vec<(String, OwnerTrust)>>
Reads owner-trust assignments via gpg --export-ownertrust.
Sourcepub fn is_initialized(&self) -> Result<InitializationStatus>
pub fn is_initialized(&self) -> Result<InitializationStatus>
Checks whether the keyring is initialized without spawning GPG.
Verifies the directory exists with mode 755 (as created by
pacman-key --init; world-readable so unprivileged pacman can read
the public keyring, pacman commit 4ef664f4) and contains a non-empty
pubring.kbx or pubring.gpg plus trustdb.gpg. Symlinks are followed.
Non-atomic and subject to TOCTOU races; use for informational
purposes, not security decisions.