Documentation
¶
Overview ¶
Package artifact defines the deterministic distribution format for immutable Starmap catalog generations.
Index ¶
- Constants
- func Open(archive, attestation []byte) (catalogs.Generation, error)
- func VerifyRelease(ctx context.Context, release Release, verifier PublisherVerifier) (catalogs.Generation, error)
- type AttestationPredicate
- type AttestationStatement
- type Bundle
- type Descriptor
- type DigestSet
- type FileDescriptor
- type PublisherVerifier
- type Release
- type ReleaseAssets
- type Subject
Constants ¶
const ( // FormatVersion is the current catalog distribution archive format. FormatVersion uint64 = 1 // MediaType is the media type of the compressed catalog archive. MediaType = "application/vnd.agentstation.starmap.catalog-artifact.v1+tar+gzip" // DescriptorMediaType is the media type of artifact.json. DescriptorMediaType = "application/vnd.agentstation.starmap.catalog-artifact-descriptor.v1+json" // AttestationPredicateType identifies the detached in-toto predicate. AttestationPredicateType = "https://agentstation.ai/starmap/catalog-generation/v1" // AttestationStatementType is the in-toto statement schema identifier. AttestationStatementType = "https://in-toto.io/Statement/v1" // Filename is the stable archive filename; generation identity is carried by // the descriptor and distribution path rather than interpolated into a path. Filename = "starmap-catalog.tar.gz" // AttestationFilename is the detached in-toto statement filename. AttestationFilename = "starmap-catalog.intoto.json" // OCIMirrorArtifactType identifies an OCI manifest that mirrors the exact // immutable release assets. The catalog archive remains a layer with // MediaType, so its digest can be compared across distribution channels. OCIMirrorArtifactType = "application/vnd.agentstation.starmap.catalog-mirror.v1" // OCIGenerationAnnotation carries the logical catalog generation ID on an // OCI mirror manifest. Consumers must still pin and verify content digests. OCIGenerationAnnotation = "ai.agentstation.starmap.generation" )
const (
// ChecksumFilename is the detached SHA-256 checksum asset.
ChecksumFilename = "starmap-catalog.tar.gz.sha256"
)
Variables ¶
This section is empty.
Functions ¶
func Open ¶
func Open(archive, attestation []byte) (catalogs.Generation, error)
Open verifies an archive and detached statement before returning its exact immutable catalog generation.
func VerifyRelease ¶
func VerifyRelease( ctx context.Context, release Release, verifier PublisherVerifier, ) (catalogs.Generation, error)
VerifyRelease checks the detached checksum, archive statement, generation compatibility, and channel-specific publisher identity before returning the exact immutable generation. It performs no activation or persistence.
Types ¶
type AttestationPredicate ¶
type AttestationPredicate struct {
GenerationID string `json:"generation_id"`
ManifestVersion uint64 `json:"manifest_version"`
SchemaVersion uint64 `json:"schema_version"`
ConsumerCompatibility catalogs.ConsumerCompatibility `json:"consumer_compatibility"`
}
AttestationPredicate records the catalog compatibility identity asserted by the detached statement. Signature and builder provenance are added and verified by the publication boundary.
type AttestationStatement ¶
type AttestationStatement struct {
Type string `json:"_type"`
Subject []Subject `json:"subject"`
PredicateType string `json:"predicateType"`
Predicate AttestationPredicate `json:"predicate"`
}
AttestationStatement is the deterministic in-toto statement emitted beside an artifact. It is deliberately detached to avoid a self-referential archive digest and to permit signing without changing reproducible artifact bytes.
type Bundle ¶
type Bundle struct {
GenerationID string
Filename string
MediaType string
Data []byte
Checksum string
AttestationFilename string
Attestation []byte
}
Bundle contains one reproducible archive and its detached attestation.
type Descriptor ¶
type Descriptor struct {
FormatVersion uint64 `json:"format_version"`
MediaType string `json:"media_type"`
GenerationID string `json:"generation_id"`
ManifestVersion uint64 `json:"manifest_version"`
SchemaVersion uint64 `json:"schema_version"`
ConsumerCompatibility catalogs.ConsumerCompatibility `json:"consumer_compatibility"`
Manifest FileDescriptor `json:"manifest"`
Payload FileDescriptor `json:"payload"`
}
Descriptor describes the complete logical generation carried by an archive.
func Inspect ¶
func Inspect(archive, attestation []byte) (Descriptor, error)
Inspect verifies the schema-independent artifact envelope and detached statement. It returns compatibility metadata without decoding the catalog payload through the current schema.
func (Descriptor) String ¶
func (d Descriptor) String() string
String returns a concise descriptor useful in logs.
type DigestSet ¶
type DigestSet struct {
SHA256 string `json:"sha256"`
}
DigestSet is the SHA-256 digest map used by an in-toto subject.
type FileDescriptor ¶
type FileDescriptor struct {
Name string `json:"name"`
MediaType string `json:"media_type"`
Checksum string `json:"checksum"`
SizeBytes int64 `json:"size_bytes"`
}
FileDescriptor binds one named artifact member to exact bytes.
type PublisherVerifier ¶
type PublisherVerifier interface {
VerifyPublisher(ctx context.Context, name string, data []byte) error
}
PublisherVerifier authenticates exact archive bytes to the caller's expected publisher. A GitHub Release implementation, for example, should require the expected repository and signer workflow when verifying build provenance.
VerifyPublisher must return nil only when data is authenticated as the exact contents of name. Implementations own credentials, clients, trust policy, network access, and lifecycle.
type Release ¶
Release contains the three immutable assets published for one catalog generation. Publisher provenance is channel-specific and is therefore verified through PublisherVerifier rather than encoded as an unsigned field.
type ReleaseAssets ¶
type ReleaseAssets struct {
GenerationID string
ArchiveChecksum string
Directory string
Files []string
}
ReleaseAssets describes one atomically staged immutable publication set.
func StageReleaseAssets ¶
func StageReleaseAssets(root string, artifact Bundle) (ReleaseAssets, error)
StageReleaseAssets validates and atomically stages archive, attestation, and checksum assets. An exact retry is idempotent; rebinding the same generation ID to different bytes returns a typed conflict.