helpers

package
v4.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 14 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCannotFindPrivKey                    = errors.New("cannot find private key")
	ErrCannotFindPrivKeyMatchingFingerprint = errors.New(
		"cannot find private key matching fingerprint",
	)
)

Functions

func ExportGpgKey

func ExportGpgKey(ctx context.Context, gpgKeyID string, gpgKeyExportPath string) error

ExportGpgKey exports a GPG key from the keyring to a file.

func GetGpgKey

func GetGpgKey(gpgKeyReader io.Reader, passphrase string) (*openpgp.Entity, error)

GetGpgKey returns a GPG key entity from the given reader, decrypting it with the provided passphrase. If passphrase is empty, it prompts interactively (falling back to empty passphrase in non-TTY environments). Exported for use by autobump (github.com/rios0rios0/autobump).

func GetGpgKeyReader

func GetGpgKeyReader(ctx context.Context, gpgKeyID string, gpgKeyPath string, appName string) (io.Reader, error)

GetGpgKeyReader returns a reader for the GPG key. The appName parameter is used for default key path generation (e.g. "autobump" -> ~/.gnupg/autobump-{keyID}.asc). Supports armored (ASCII) and base64-encoded armored key formats. Exported for use by autobump (github.com/rios0rios0/autobump).

func ReadSSHSigningKey

func ReadSSHSigningKey(signingKey, sshProgram string) (string, error)

ReadSSHSigningKey resolves the SSH signing key reference from the git config value. It handles two modes:

  • File path: expands ~ to the home directory and verifies the file exists (existing behavior).
  • Inline public key (starts with "ssh-", "ecdsa-", or "sk-"): when using ssh-keygen (either as default or explicitly configured via gpg.ssh.program), verifies SSH_AUTH_SOCK is set. Custom signing programs (e.g. op-ssh-sign-wsl) handle agent communication internally.

Exported for use by autobump (github.com/rios0rios0/autobump).

func SignSSHCommit

func SignSSHCommit(
	ctx context.Context, commitContent []byte, signingKeyRef, sshProgram string,
) (string, error)

SignSSHCommit signs commit content using an SSH signing program and returns the signature. It uses the `-Y sign` interface which is the same mechanism Git uses internally. When signingKeyRef is an inline public key (detected via isInlineSSHKey), it writes the key to a temp file and passes `-U` so the program signs via the SSH agent. sshProgram overrides the signing binary (e.g. "op-ssh-sign-wsl"); empty defaults to "ssh-keygen".

Types

This section is empty.

Jump to

Keyboard shortcuts

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