attestation

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const CollectionType = "https://witness.testifysec.com/attestation-collection/v0.1"

Variables

This section is empty.

Functions

func RegisterAttestation

func RegisterAttestation(name, uri string, run RunType, factoryFunc AttestorFactory)

Types

type AttestationContext

type AttestationContext struct {
	// contains filtered or unexported fields
}

func NewContext

func NewContext(attestors []Attestor, opts ...AttestationContextOption) (*AttestationContext, error)

func (*AttestationContext) CompletedAttestors

func (ctx *AttestationContext) CompletedAttestors() []Attestor

func (*AttestationContext) Context

func (ctx *AttestationContext) Context() context.Context

func (*AttestationContext) Hashes

func (ctx *AttestationContext) Hashes() []crypto.Hash

func (*AttestationContext) Materials

func (ctx *AttestationContext) Materials() map[string]cryptoutil.DigestSet

func (*AttestationContext) Products

func (ctx *AttestationContext) Products() map[string]Product

func (*AttestationContext) RunAttestors

func (ctx *AttestationContext) RunAttestors() error

func (*AttestationContext) WorkingDir

func (ctx *AttestationContext) WorkingDir() string

type AttestationContextOption

type AttestationContextOption func(ctx *AttestationContext)

func WithCommandAttestor

func WithCommandAttestor(attestor Attestor) AttestationContextOption

func WithHashes

func WithHashes(hashes []crypto.Hash) AttestationContextOption

func WithMaterialAttestor

func WithMaterialAttestor(attestor Attestor) AttestationContextOption

func WithProductAttestor

func WithProductAttestor(attestor Attestor) AttestationContextOption

func WithWorkingDir

func WithWorkingDir(workingDir string) AttestationContextOption

type Attestor

type Attestor interface {
	Name() string
	Type() string
	RunType() RunType
	Attest(ctx *AttestationContext) error
}

func Attestors

func Attestors(nameOrTypes []string) ([]Attestor, error)

type AttestorFactory

type AttestorFactory func() Attestor

func FactoryByName

func FactoryByName(name string) (AttestorFactory, bool)

func FactoryByType

func FactoryByType(uri string) (AttestorFactory, bool)

type Collection

type Collection struct {
	Name         string                  `json:"name"`
	Attestations []CollectionAttestation `json:"attestations"`
}

func NewCollection

func NewCollection(name string, attestors []Attestor) Collection

func (*Collection) Artifacts

func (c *Collection) Artifacts() map[string]cryptoutil.DigestSet

Artifacts returns a map of digestsets that describe the union of the materials and products from the collection. This essentially gives a view of end state of the files after all the attestors in the collection ran.

func (*Collection) Materials

func (c *Collection) Materials() map[string]cryptoutil.DigestSet

func (*Collection) Subjects

func (c *Collection) Subjects() map[string]cryptoutil.DigestSet

type CollectionAttestation

type CollectionAttestation struct {
	Type        string   `json:"type"`
	Attestation Attestor `json:"attestation"`
}

func NewCollectionAttestation

func NewCollectionAttestation(attestor Attestor) CollectionAttestation

func (*CollectionAttestation) UnmarshalJSON

func (c *CollectionAttestation) UnmarshalJSON(data []byte) error

type ErrAttestationNotFound

type ErrAttestationNotFound string

func (ErrAttestationNotFound) Error

func (e ErrAttestationNotFound) Error() string

type ErrInvalidOption

type ErrInvalidOption struct {
	Option string
	Reason string
}

func (ErrInvalidOption) Error

func (e ErrInvalidOption) Error() string

type Materialer

type Materialer interface {
	Materials() map[string]cryptoutil.DigestSet
}

type Producer

type Producer interface {
	Products() map[string]Product
}

type Product

type Product struct {
	MimeType string               `json:"mime_type"`
	Digest   cryptoutil.DigestSet `json:"digest"`
}

type RunType

type RunType string
const (
	Internal    RunType = "internal"
	PreRunType  RunType = "pre"
	PostRunType RunType = "post"
)

func (RunType) String

func (r RunType) String() string

type Subjecter

type Subjecter interface {
	Subjects() map[string]cryptoutil.DigestSet
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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