attest

package
v0.7.16-dev.1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package attest is the public attestation format for published versions: the in-toto v1 statement, the publish predicate, the DSSE envelope, and offline verification. It is what the CLI — and any third-party client — needs to verify a release against the registry's well-known signing keys; producing signatures stays server-side.

Index

Constants

View Source
const PayloadType = "application/vnd.in-toto+json"

PayloadType is the DSSE payload type for in-toto statements.

View Source
const PredicateType = "https://agentry.dev/attestation/publish/v1"

PredicateType is the Agentry publish attestation predicate.

View Source
const RulesetPredicateType = "https://agentry.dev/attestation/ruleset/v1"

RulesetPredicateType is the rule-bundle attestation predicate: the registry signs the bundle `validate --rules-update` serves, with the same key that signs releases, so a client pins by signature and not only by the digest the same server advertised.

Variables

This section is empty.

Functions

func KeyIDFor

func KeyIDFor(pub *ecdsa.PublicKey) string

KeyIDFor derives a stable key id from the public key (sha256 of DER).

func PAE

func PAE(payloadType string, payload []byte) []byte

PAE is the DSSE Pre-Authentication Encoding.

func VerifyPayload added in v0.7.9

func VerifyPayload(env DSSEEnvelope, publicKeyPEM, payloadType string) ([]byte, error)

VerifyPayload checks a DSSE envelope of the given payload type against a PEM public key and returns the signed payload. The same key may sign more than one kind of payload, so the type is checked before anything else: the signature covers it, and an envelope of another type is refused rather than decoded as this one. The key rule is VerifyEnvelope's: the caller chooses the key, never the envelope.

Types

type DSSEEnvelope

type DSSEEnvelope struct {
	PayloadType string          `json:"payloadType"`
	Payload     string          `json:"payload"` // base64 of the statement
	Signatures  []DSSESignature `json:"signatures"`
}

DSSEEnvelope is the signed wrapper (dsse v1).

type DSSESignature

type DSSESignature struct {
	KeyID string `json:"keyid"`
	Sig   string `json:"sig"` // base64
}

DSSESignature is one signature over the PAE-encoded payload.

type InTotoStatement

type InTotoStatement struct {
	Type          string      `json:"_type"`
	Subject       []Subject   `json:"subject"`
	PredicateType string      `json:"predicateType"`
	Predicate     interface{} `json:"predicate"`
}

InTotoStatement is the signed subject (in-toto v1).

func BuildRulesetStatement

func BuildRulesetStatement(registry, semver, bundleDigest string) InTotoStatement

BuildRulesetStatement assembles the in-toto statement for a rule bundle: subject "ruleset" with the bundle's content digest.

func BuildStatement

func BuildStatement(registry, agentPath, version, archiveDigest, commitSHA, source string, run ScanRunRef, policyVersion int) InTotoStatement

BuildStatement assembles the in-toto statement for a published version.

func VerifyEnvelope

func VerifyEnvelope(env DSSEEnvelope, publicKeyPEM string) (InTotoStatement, error)

VerifyEnvelope checks a DSSE envelope of an in-toto statement against a PEM public key; an envelope of any other payload type is refused. Used by the CLI (offline), the server's own tests, and third-party verifiers.

The caller chooses the key. A signature's keyid is a label the signer attached, not evidence of anything: it is never read here, and a verifier must never resolve a key from it (fetching or selecting whatever key an envelope names would let the envelope's author pick the key that checks it). The key comes from a source the verifier already trusts.

type PublishPredicate

type PublishPredicate struct {
	Registry    string     `json:"registry"`
	Agent       string     `json:"agent"`
	Version     string     `json:"version"`
	CommitSHA   string     `json:"commitSha,omitempty"`
	Source      string     `json:"source"`
	ScanRun     ScanRunRef `json:"scanRun"`
	PolicyVer   int        `json:"policyVersion"`
	PublishedAt string     `json:"publishedAt"`
}

PublishPredicate is the publish predicate.

type RulesetPredicate

type RulesetPredicate struct {
	Registry string `json:"registry"`
	Semver   string `json:"semver"`
	SignedAt string `json:"signedAt"`
}

RulesetPredicate describes the signed bundle.

type ScanRunRef

type ScanRunRef struct {
	ID           string `json:"id"`
	RulesetVer   string `json:"rulesetVersion"`
	ReportDigest string `json:"reportDigest"`
	JudgeModel   string `json:"judgeModel,omitempty"`
}

ScanRunRef records reproducibility fields.

type Subject

type Subject struct {
	Name   string            `json:"name"`
	Digest map[string]string `json:"digest"`
}

Subject binds the statement to the archive digest.

Jump to

Keyboard shortcuts

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