Help us shape the future of Go! Take the 2026 Go Developer Survey

provenance

package
v0.1.56 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const GitNotesRef = "refs/notes/brocode-provenance"

GitNotesRef is the dedicated git notes reference for BroCode attestations.

Variables

This section is empty.

Functions

func ComputeHash

func ComputeHash(content string) string

ComputeHash computes a SHA-256 hexadecimal hash of raw bytes or string.

func FormatCommitTrailers

func FormatCommitTrailers(att Attestation) string

FormatCommitTrailers returns standard RFC-822 Git commit trailers.

func RecordGitNote

func RecordGitNote(repoDir string, commitRef string, att Attestation) error

RecordGitNote stores the attestation JSON in Git Notes under refs/notes/brocode-provenance.

Types

type Attestation

type Attestation struct {
	Version      string    `json:"version"`
	SessionID    string    `json:"session_id"`
	TurnID       int       `json:"turn_id"`
	Timestamp    time.Time `json:"timestamp"`
	ModelID      string    `json:"model_id"`
	AgentVersion string    `json:"agent_version"`
	UserPrompt   string    `json:"user_prompt,omitempty"`
	PromptHash   string    `json:"prompt_hash"`
	DiffHash     string    `json:"diff_hash"`
	LSPClean     bool      `json:"lsp_clean"`
	TestsPassed  bool      `json:"tests_passed"`
	TokenCostUSD float64   `json:"token_cost_usd,omitempty"`
	ProofHash    string    `json:"proof_hash"`
}

Attestation records verifiable cryptographic metadata for an AI-assisted code change.

func NewAttestation

func NewAttestation(sessionID string, turnID int, modelID, agentVersion, userPrompt, diffContent string, lspClean, testsPassed bool, costUSD float64) Attestation

NewAttestation creates a new Attestation and calculates its Merkle ProofHash.

func ReadGitNote

func ReadGitNote(repoDir string, commitRef string) (*Attestation, error)

ReadGitNote retrieves the attestation JSON from Git Notes for a given commit.

func VerifyCommitAttestation

func VerifyCommitAttestation(repoDir string, commitRef string) (*Attestation, bool, error)

VerifyCommitAttestation verifies the integrity of an attestation against git history.

func (*Attestation) ComputeProofHash

func (a *Attestation) ComputeProofHash() string

ComputeProofHash computes the deterministic cryptographic binding across all attestation fields.

Jump to

Keyboard shortcuts

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