{"modulePath":"github.com/chainloop-dev/chainloop","version":"v1.138.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package commitverification\n\n## Functions\n\n```go\nfunc DetectSignatureType(signature string) string\n```\nDetectSignatureType inspects the signature content to determine its type GitHub supports GPG, SSH, and S/MIME signatures Format references: - Git documentation: [https://git-scm.com/docs/gitformat-signature](https://git-scm.com/docs/gitformat-signature) - SSH format: [https://blog.gitbutler.com/signing-commits-in-git-explained](https://blog.gitbutler.com/signing-commits-in-git-explained)\n\n## Types\n\n```go\ntype CommitVerification struct {\n\t// Whether verification was attempted\n\tAttempted bool\n\t// Verification status\n\tStatus VerificationStatus\n\t// Human-readable reason for the status\n\tReason string\n\t// Platform that performed the verification (e.g., \"github\", \"gitlab\")\n\tPlatform string\n\t// Optional: The signing key ID if verified\n\tKeyID string\n\t// Optional: The signature algorithm used\n\tSignatureAlgorithm string\n}\n```\nCommitVerification represents the result of a commit signature verification\n\n```go\nfunc VerifyGitHubCommit(ctx context.Context, owner, repo, commitHash, token string, logger *zerolog.Logger) *CommitVerification\n```\nVerifyGitHubCommit verifies a commit signature using the GitHub API\n\n```go\nfunc VerifyGitLabCommit(ctx context.Context, baseURL, projectPath, commitHash string, credentials GitLabCredentials, logger *zerolog.Logger) *CommitVerification\n```\nVerifyGitLabCommit verifies a commit signature using the GitLab API\n\n```go\ntype GitLabCredentials struct {\n\t// APIToken is a personal, project or group access token with the read_api scope.\n\t// It is required to verify commits of private and internal projects.\n\tAPIToken string\n\t// JobToken is the CI/CD job token. GitLab does not accept job tokens on the commit\n\t// signature endpoint and handles the request as anonymous, which only works for public projects.\n\tJobToken string\n}\n```\nGitLabCredentials holds the tokens that can authenticate calls to the GitLab API\n\n```go\nfunc GitLabCredentialsFromEnv() GitLabCredentials\n```\nGitLabCredentialsFromEnv reads the GitLab API credentials from GITLAB\\_TOKEN and CI\\_JOB\\_TOKEN\n\n```go\ntype VerificationStatus int\n```\nVerificationStatus represents the status of a commit signature verification\n\n```go\nconst (\n\t// VerificationStatusUnspecified indicates an unspecified status\n\tVerificationStatusUnspecified VerificationStatus = iota\n\t// VerificationStatusVerified indicates the signature was successfully verified\n\tVerificationStatusVerified\n\t// VerificationStatusUnverified indicates the signature check failed or is invalid\n\tVerificationStatusUnverified\n\t// VerificationStatusUnavailable indicates verification could not be performed\n\tVerificationStatusUnavailable\n\t// VerificationStatusNotApplicable indicates no signature present or platform doesn't support it\n\tVerificationStatusNotApplicable\n)\n```\n\n","path":"github.com/chainloop-dev/chainloop/pkg/attestation/crafter/runners/commitverification","name":"commitverification","synopsis":"","isRedistributable":true}
