repoman.gpg
GPG key fetch and verification helpers. No GTK — fully unit-testable.
-
is_ppa_uri(uri)[source]
Return True if uri points at a Launchpad PPA host.
- Parameters:
uri (str) – Repository URI to test.
- Returns:
True for ppa.launchpadcontent.net and ppa.launchpad.net.
- Return type:
bool
-
fetch_key(url)[source]
Download a GPG key from a URL. Returns (key_bytes, error_str).
- Parameters:
url (str)
- Return type:
tuple[bytes | None, str | None]
-
fetch_ppa_key(owner, ppa)[source]
Fetch a PPA signing key via launchpadlib. Returns (key_bytes, error_str).
- Parameters:
-
- Return type:
tuple[bytes | None, str | None]
-
verify_key(content)[source]
Verify GPG key via gpg –import-options show-only. Returns (valid, error).
- Parameters:
content (str | bytes)
- Return type:
tuple[bool, str]
-
key_to_b64(key_bytes)[source]
Base64-encode key bytes for transmission in a JSON polkit payload.
- Parameters:
key_bytes (bytes)
- Return type:
str
-
read_key_text(path)[source]
Read a key file as ASCII-armored text, or None if binary/missing.
- Parameters:
path (Path)
- Return type:
str | None
-
read_key_content(path)[source]
Read a keyring file as displayable ASCII text.
ASCII-armored files are returned directly. Binary (dearmored) files
are converted via gpg –enarmor so they can be shown in the editor.
Returns None if the file is missing, empty, or conversion fails.
- Parameters:
path (Path)
- Return type:
str | None