Documentation
¶
Index ¶
- Constants
- Variables
- func ConfigureHelper(userName, gitSigningKey string) error
- func ExpandSigningKeyPath(signingKey string) string
- func ExtractGitConfiguration(ctx context.Context, workingDir string) (string, string, error)
- func HandleGitSSHProgramCall(certPath, namespace, bufferFile string) error
- func IsLiteralSSHKey(signingKey string) bool
- func RemoveHelper(userName string) error
- func ResolveSigningKey(signingKey, workingDir string) string
- func SetSignatureServerURL(url string)
- type GitSSHSignatureRequest
- type GitSSHSignatureResponse
Constants ¶
const ( GPGFormatConfigKey = "gpg.format" UsersSigningKeyConfigKey = "user.signingkey" GPGFormatSSH = "ssh" )
const (
HelperScript = `#!/bin/bash
devsy internal agent git-ssh-signature "$@"
`
)
Variables ¶
var ( GitConfigTemplate = ` [gpg "ssh"] program = ` + pkgconfig.SSHSignatureHelperName + ` [gpg] format = ssh [user] signingkey = %s ` )
Functions ¶
func ConfigureHelper ¶
ConfigureHelper sets up the Git SSH signing helper script and updates the Git configuration for the specified user.
This function: - sets user.signingkey git config - creates a wrapper script for calling git-ssh-signature - users this script as gpg.ssh.program This is needed since git expects `gpg.ssh.program` to be an executable.
func ExpandSigningKeyPath ¶
ExpandSigningKeyPath expands a leading ~ or ~user prefix in an SSH signing key path.
func ExtractGitConfiguration ¶
ExtractGitConfiguration reads gpg.format and user.signingkey from git config at workingDir.
func HandleGitSSHProgramCall ¶
HandleGitSSHProgramCall implements logic handling call from git when signing a commit.
func IsLiteralSSHKey ¶
IsLiteralSSHKey reports whether signingKey is an inline SSH public key rather than a file path.
func RemoveHelper ¶
RemoveHelper removes the git SSH signing helper script and any related configuration.
func ResolveSigningKey ¶
ResolveSigningKey expands ~ prefixes and resolves relative SSH key paths against workingDir.
func SetSignatureServerURL ¶
func SetSignatureServerURL(url string)
SetSignatureServerURL sets the server URL override for testing.
Types ¶
type GitSSHSignatureRequest ¶
type GitSSHSignatureRequest struct {
Content string
KeyPath string
PublicKey string // Public key content; when set, written to a temp file for ssh-keygen.
Namespace string `json:",omitempty"`
}
GitSSHSignatureRequest describes an SSH signature request forwarded from a workspace container.
func (*GitSSHSignatureRequest) SignWithHostKey ¶
func (req *GitSSHSignatureRequest) SignWithHostKey( ctx context.Context, hostSigningKey string, ) (*GitSSHSignatureResponse, error)
SignWithHostKey signs the content, preferring a matching host signing key file when available.
type GitSSHSignatureResponse ¶
type GitSSHSignatureResponse struct {
Signature []byte
}
GitSSHSignatureResponse holds the raw SSH signature produced by ssh-keygen.