class documentation

Signature vendor that uses the GPG package for signing and verification.

Supports git config options: - gpg.minTrustLevel: Minimum trust level for signature verification

Class Method available Check if the gpg Python package is available.
Class Method from_config Create a GPG vendor from git configuration.
Method __init__ Initialize the GPG package vendor.
Method sign Sign data with a GPG key.
Method verify Verify a GPG signature.
Instance Variable min_trust_level Undocumented

Inherited from SignatureVerifier (via SignatureSigner):

Instance Variable keyids Undocumented
def available(cls) -> bool:

Check if the gpg Python package is available.

Returns
boolTrue if gpg package can be imported, False otherwise
def from_config(cls, config: Config | None = None, keyids: Iterable[str] | None = None) -> GPGSignatureVendor:

Create a GPG vendor from git configuration.

Parameters
config:Config | NoneGit configuration to read settings from
keyids:Iterable[str] | NoneOptional iterable of trusted GPG key IDs for verification
Returns
GPGSignatureVendorGPGSignatureVendor instance configured from the config
def __init__(self, min_trust_level: str | None = None, keyids: Iterable[str] | None = None):

Initialize the GPG package vendor.

Parameters
min_trust_level:str | NoneMinimum trust level required (undefined, never, marginal, fully, ultimate). If None, any trust level is accepted.
keyids:Iterable[str] | NoneOptional iterable of trusted GPG key IDs for verification. If provided, only signatures from these keys will be trusted.
def sign(self, data: bytes, keyid: str | None = None) -> bytes:

Sign data with a GPG key.

Parameters
data:bytesThe data to sign
keyid:str | NoneOptional GPG key ID to use for signing. If not specified, the default GPG key will be used.
Returns
bytesThe signature as bytes
def verify(self, data: bytes, signature: bytes):

Verify a GPG signature.

Parameters
data:bytesThe data that was signed
signature:bytesThe signature to verify
Raises
BadSignatureif GPG signature verification fails
UntrustedSignatureif the signature was not created by a trusted key or trust level is below minimum
min_trust_level =

Undocumented