types

package
v3.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2025 License: MIT Imports: 12 Imported by: 1

Documentation

Overview

Package types represents common types used by the REST API

Index

Constants

View Source
const (
	// CosignSignatureType is a mediatype associated with cosign-generated digital signatures.
	CosignSignatureType = "dev.cosignproject.cosign/signature"
	// NotarySignatureType is a mediatype associated with notary-generated digital signatures.
	NotarySignatureType = notaryreg.ArtifactTypeNotation
	// SignaturePayloadMediaType is the media type for cosign signature payloads.
	SignaturePayloadMediaType = "application/vnd.dev.cosign.simplesigning.v1+json"
	// AnnotationX509ChainThumbprint stores a certificate chain as a list of thumbprints. A manifest annotation key.
	// Note: Notation keeps this internal at "github.com/notaryproject/notation-go/internal/envelope", which
	// is odd as it's a required property of a notation signature.
	AnnotationX509ChainThumbprint = "io.cncf.notary.x509chain.thumbprint#S256"
)
View Source
const (
	// HeaderContentDigest is a header used to denote the body's digest.
	HeaderContentDigest = "X-Content-Digest"
)

Variables

View Source
var TopologicalOrderingOfTypes = []string{"blob", "bottle", "manifest", "event", "signature"}

TopologicalOrderingOfTypes is the list of different input types in the order they need to be process/applied.

Functions

func NewMissingDigestsError

func NewMissingDigestsError(item string, missing []digest.Digest, extraKV ...any) error

NewMissingDigestsError created a new error with missing items referenced by digest.

Types

type Event

type Event struct {
	ManifestDigest digest.Digest `json:"manifestDigest,omitempty"`
	Action         EventAction   `json:"action,omitempty"`
	Repository     string        `json:"repository,omitempty"`
	Tag            string        `json:"tag,omitempty"`
	AuthRequired   bool          `json:"authRequired,omitempty"`

	// Bandwidth in bytes per second
	Bandwidth uint64 `json:"bandwidth,omitempty"`

	Timestamp time.Time `json:"timestamp,omitempty"`
	Username  string    `json:"username,omitempty"`
}

Event is the /event request body.

func (Event) Validate

func (e Event) Validate() error

Validate Events.

type EventAction

type EventAction string

EventAction is string constant that indicates a type of event, such as push or pull.

const (
	// EventPush indicates a push action.
	EventPush EventAction = "push"
	// EventPull indicates a pull action.
	EventPull EventAction = "pull"
)

type ListResultEntry

type ListResultEntry struct {
	CreatedAt time.Time
	Digests   []digest.Digest
	Data      []byte
}

ListResultEntry is a single entry in list request.

type LocationResponse

type LocationResponse struct {
	Repository   string
	AuthRequired bool
	Digest       digest.Digest
}

LocationResponse is a struct for the location.

type MissingDigestsError

type MissingDigestsError struct {
	httputil.HTTPError
	MissingDigests []digest.Digest `json:"missingDigests"`
}

MissingDigestsError is used to denote that Blobs are missing.

func (*MissingDigestsError) Error

func (e *MissingDigestsError) Error() string

func (*MissingDigestsError) ErrorArgs

func (e *MissingDigestsError) ErrorArgs() []any

ErrorArgs returns extra KV args for logging the error.

func (*MissingDigestsError) ResponseBody

func (e *MissingDigestsError) ResponseBody() ([]byte, error)

ResponseBody returns JSON response body.

type SearchResult

type SearchResult struct {
	Digests []digest.Digest
	Data    []byte
}

SearchResult is a result from a BottleSearch Request.

type SignatureDetail

type SignatureDetail struct {
	SignatureType string             `json:"signatureType"` // currently dev.cosignproject.cosign/signature
	Signature     string             `json:"signature"`     // base64 encoded signature
	Descriptor    ocispec.Descriptor `json:"ociDescriptor"` // data about the oci payload
	PublicKey     string             `json:"publicKey"`     // public key associated with signature (Verify)
	Annotations   map[string]string  `json:"annotations"`   // extra data, such as verify api, userid, etc.
}

SignatureDetail encapsulates important information about a signature, including media types, signature data itself, identity and metadata.

func (SignatureDetail) Validate

func (s SignatureDetail) Validate() error

Validate SignatureDetail.

type SignatureIdentity

type SignatureIdentity struct {
	BottleID digest.Digest     `json:"subjectBottleID"` // bottle digest
	KeyFp    string            `json:"keyFingerprint"`  // fingerprint of key
	Identity map[string]string `json:"identity"`        // a set of key-value pairs (annotations) for known key identity
}

SignatureIdentity provides a simple view of a single signature's Identity information.

type SignatureValid

type SignatureValid struct {
	BottleID  digest.Digest `json:"subjectBottleID"` // bottle digest
	KeyFp     string        `json:"keyFingerprint"`  // fingerprint of key
	Validated bool          `json:"validated"`       // true if the validation process succeeds (validated or trusted)
}

SignatureValid provides a simple view of a single signature's validation status.

type SignatureValidation

type SignatureValidation struct {
	Signature   string            `json:"signature"`   // base64 encoded signature data
	PublicKey   string            `json:"publicKey"`   // public key associated with signature
	Validated   bool              `json:"validated"`   // true if the signature was validated (public key -> signature match)
	Trusted     bool              `json:"trusted"`     // true if the signature identity has been validated (fingerprint+id known)
	Annotations map[string]string `json:"annotations"` // extra data including identity and id verification details
}

SignatureValidation provides validation details about a specific signature, along with relevant information.

type SignatureValidationSummary

type SignatureValidationSummary struct {
	SubjectManifest digest.Digest `json:"subjectManifest"` // manifest digest, signed object
	SubjectBottleid digest.Digest `json:"subjectBottleID"` // bottle digest, not currently part of sig data
	Validated       bool          `json:"sigValid"`        // true if signature was validated (self-consistent)
	Trusted         bool          `json:"sigTrusted"`      // true if signature identity was validated
	Fingerprint     string        `json:"sigFingerprint"`  // signature fingerprint data
	// TODO: add attestation key values?
	Annotations map[string]string `json:"sigAnnotations"` // signature annotations, including ident and attestations
}

SignatureValidationSummary provides brief information about signatures for a bottle/manifest. Only validation and Trust information is included, along with metadata annotations to describe the signature identity and intent.

type SignaturesSummary

type SignaturesSummary struct {
	SubjectManifest digest.Digest     `json:"subjectManifest"` // manifest digest, signed object
	SubjectBottleID digest.Digest     `json:"subjectBottleid"` // bottle digest, not currently part of sig data
	Signatures      []SignatureDetail `json:"signatures"`
}

SignaturesSummary represents a summary of all signature details in a concise format. This summary structure is intended to be serialized into JSON for transmission to telemetry or another location, and is not compatible with any OCI structures.

func (SignaturesSummary) Validate

func (s SignaturesSummary) Validate() error

Validate SignatureSummary.

Jump to

Keyboard shortcuts

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