infrastructure

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveSignerFromGitConfig added in v0.3.0

func ResolveSignerFromGitConfig(
	gpgSign, signingFormat, signingKey, gpgKeyPath, gpgPassphrase, appName, sshProgram string,
) (globalEntities.CommitSigner, error)

ResolveSignerFromGitConfig determines if and how commits should be signed based on git configuration values. Returns nil if signing is not configured (gpgSign is not "true").

Parameters map to standard git config values:

  • gpgSign: commit.gpgsign
  • signingFormat: gpg.format ("ssh" for SSH signing, anything else for GPG)
  • signingKey: user.signingkey (key ID for GPG, file path for SSH)
  • gpgKeyPath: optional file path to exported GPG key (empty = auto-detect from keyring)
  • gpgPassphrase: GPG key passphrase (empty = prompt interactively)
  • appName: application name used for GPG key path generation (e.g., "autobump")
  • sshProgram: gpg.ssh.program — custom signing binary (empty = "ssh-keygen")

Types

type GPGSigner

type GPGSigner struct {
	// contains filtered or unexported fields
}

GPGSigner signs commits using a GPG key.

func NewGPGSigner

func NewGPGSigner(key *openpgp.Entity) *GPGSigner

NewGPGSigner creates a new GPGSigner with the given GPG key entity.

func (*GPGSigner) Key

func (s *GPGSigner) Key() *openpgp.Entity

Key returns the underlying GPG key entity for use with go-git's SignKey option.

func (*GPGSigner) Sign

func (s *GPGSigner) Sign(_ context.Context, commitContent []byte) (string, error)

Sign signs the commit content using the GPG key and returns the armored signature.

type SSHSigner

type SSHSigner struct {
	// contains filtered or unexported fields
}

SSHSigner signs commits using an SSH key. The keyRef field holds either a file path to a private key or an inline public key string (e.g. "ssh-ed25519 AAAAC3...") for ssh-agent-based signing.

func NewSSHSigner

func NewSSHSigner(keyRef, sshProgram string) *SSHSigner

NewSSHSigner creates a new SSHSigner with the given SSH key reference. keyRef may be a file path to a private key or an inline public key string for agent signing. sshProgram overrides the signing binary (e.g. "op-ssh-sign-wsl"); empty defaults to "ssh-keygen".

func (*SSHSigner) Sign

func (s *SSHSigner) Sign(ctx context.Context, commitContent []byte) (string, error)

Sign signs the commit content using the configured SSH signing program and returns the signature.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL