git2goutil

package
v16.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCommitSignature

func CreateCommitSignature(signingKeyPath string, contentToSign []byte) ([]byte, error)

CreateCommitSignature reads the given signing key and produces PKCS#7 detached signature. When the path to the signing key is not present, an empty signature is returned.

func OpenRepository

func OpenRepository(path string) (*git.Repository, error)

OpenRepository opens the repository located at path as a Git2Go repository.

func VerifySSHSignature added in v16.1.0

func VerifySSHSignature(pubKeyPath string, signatureText, signedText []byte) error

VerifySSHSignature reads the given signing public key and verifies whether the signature matched the signed text

Types

type CommitSubmitter

type CommitSubmitter struct {
	Repo           *git.Repository
	SigningKeyPath string
}

CommitSubmitter is the helper struct to make signed Commits conveniently.

func NewCommitSubmitter

func NewCommitSubmitter(repo *git.Repository, signingKeyPath string) *CommitSubmitter

NewCommitSubmitter creates a new CommitSubmitter.

func (*CommitSubmitter) Commit

func (cs *CommitSubmitter) Commit(
	author, committer *git.Signature,
	messageEncoding git.MessageEncoding,
	message string,
	tree *git.Tree,
	parents ...*git.Commit,
) (*git.Oid, error)

Commit commits a commit with or without signature depends on SigningKeyPath value.

Jump to

Keyboard shortcuts

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