Skip to main content

GpgConfig

Struct GpgConfig 

Source
pub struct GpgConfig {
    pub format: GpgFormat,
    pub program: String,
    pub generic_program: Option<String>,
    pub openpgp_program: Option<String>,
    pub x509_program: Option<String>,
    pub ssh_program: Option<String>,
    pub signing_key: Option<String>,
    pub min_trust_level: Option<TrustLevel>,
    pub ssh_allowed_signers: Option<String>,
    pub ssh_revocation_file: Option<String>,
}
Expand description

Resolved signing/verification configuration.

Fields§

§format: GpgFormat

The selected format.

§program: String

The resolved program command for Self::format (used for signing; may be a bare name to look up on $PATH).

§generic_program: Option<String>

gpg.program (the format-agnostic fallback), if set.

§openpgp_program: Option<String>

gpg.openpgp.program, if set.

§x509_program: Option<String>

gpg.x509.program, if set.

§ssh_program: Option<String>

gpg.ssh.program, if set.

§signing_key: Option<String>

user.signingkey, if set.

§min_trust_level: Option<TrustLevel>

gpg.minTrustLevel, if set.

§ssh_allowed_signers: Option<String>

gpg.ssh.allowedSignersFile, if set (path; leading ~/ expanded).

§ssh_revocation_file: Option<String>

gpg.ssh.revocationFile, if set (path; leading ~/ expanded).

Implementations§

Source§

impl GpgConfig

Source

pub fn from_config(config: &ConfigSet) -> Result<GpgConfig>

Read the signing configuration from a ConfigSet.

§Errors

Returns Error::ConfigError when gpg.format holds an unrecognized value (Git rejects this case-sensitively).

Source

pub fn resolve_signing_key( &self, key_override: Option<&str>, committer_default: &str, ) -> String

The signing key to use: the explicit key_override, else user.signingkey, else the supplied committer identity (Git passes git_committer_info(IDENT_STRICT | IDENT_NO_DATE)).

Source

pub fn resolve_program_path(&self) -> Result<PathBuf>

Resolve Self::program to an executable path.

Mirrors Git’s program resolution: a leading ~/ expands to $HOME, an absolute path is used verbatim, and a bare name is searched on $PATH.

Trait Implementations§

Source§

impl Clone for GpgConfig

Source§

fn clone(&self) -> GpgConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GpgConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.