v1

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: Apache-2.0 Imports: 8 Imported by: 59

Documentation

Index

Constants

View Source
const StatementTypeUri = "https://in-toto.io/Statement/v1"

Variables

View Source
var (
	ErrIncorrectDigestLength = errors.New("digest has incorrect length")
	ErrInvalidDigestEncoding = errors.New("digest is not valid hex-encoded string")
	ErrRDRequiredField       = errors.New("at least one of name, URI, or digest are required")
)
View Source
var (
	ErrInvalidStatementType  = errors.New("wrong statement type")
	ErrSubjectRequired       = errors.New("at least one subject required")
	ErrDigestRequired        = errors.New("at least one digest required")
	ErrPredicateTypeRequired = errors.New("predicate type required")
	ErrPredicateRequired     = errors.New("predicate object required")
)
View Source
var File_in_toto_attestation_v1_resource_descriptor_proto protoreflect.FileDescriptor
View Source
var File_in_toto_attestation_v1_statement_proto protoreflect.FileDescriptor
View Source
var HashAlgorithms = map[string]HashAlgorithm{
	"md5":        AlgorithmMD5,
	"sha1":       AlgorithmSHA1,
	"sha224":     AlgorithmSHA224,
	"sha512_224": AlgorithmSHA512_224,
	"sha256":     AlgorithmSHA256,
	"sha512_256": AlgorithmSHA512_256,
	"sha384":     AlgorithmSHA384,
	"sha512":     AlgorithmSHA512,
	"sha3_224":   AlgorithmSHA3_224,
	"sha3_256":   AlgorithmSHA3_256,
	"sha3_384":   AlgorithmSHA3_384,
	"sha3_512":   AlgorithmSHA3_512,
	"gitBlob":    AlgorithmGitBlob,
	"gitCommit":  AlgorithmGitCommit,
	"gitTag":     AlgorithmGitTag,
	"gitTree":    AlgorithmGitTree,
	"dirHash":    AlgorithmDirHash,
}

HashAlgorithms indexes the known algorithms in a dictionary by their string value

Functions

This section is empty.

Types

type HashAlgorithm added in v1.1.1

type HashAlgorithm string
const (
	AlgorithmMD5        HashAlgorithm = "md5"
	AlgorithmSHA1       HashAlgorithm = "sha1"
	AlgorithmSHA224     HashAlgorithm = "sha224"
	AlgorithmSHA512_224 HashAlgorithm = "sha512_224"
	AlgorithmSHA256     HashAlgorithm = "sha256"
	AlgorithmSHA512_256 HashAlgorithm = "sha512_256"
	AlgorithmSHA384     HashAlgorithm = "sha384"
	AlgorithmSHA512     HashAlgorithm = "sha512"
	AlgorithmSHA3_224   HashAlgorithm = "sha3_224"
	AlgorithmSHA3_256   HashAlgorithm = "sha3_256"
	AlgorithmSHA3_384   HashAlgorithm = "sha3_384"
	AlgorithmSHA3_512   HashAlgorithm = "sha3_512"
	AlgorithmGitBlob    HashAlgorithm = "gitBlob"
	AlgorithmGitCommit  HashAlgorithm = "gitCommit"
	AlgorithmGitTag     HashAlgorithm = "gitTag"
	AlgorithmGitTree    HashAlgorithm = "gitTree"
	AlgorithmDirHash    HashAlgorithm = "dirHash"
)

func (HashAlgorithm) HexLength added in v1.1.1

func (algo HashAlgorithm) HexLength() int

HexLength returns the expected length of an algorithm's hash when hexencoded

func (HashAlgorithm) String added in v1.1.1

func (algo HashAlgorithm) String() string

String returns the hash algorithm name as a string

type ResourceDescriptor

type ResourceDescriptor struct {
	Name             string            `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Uri              string            `protobuf:"bytes,2,opt,name=uri,proto3" json:"uri,omitempty"`
	Digest           map[string]string `` /* 139-byte string literal not displayed */
	Content          []byte            `protobuf:"bytes,4,opt,name=content,proto3" json:"content,omitempty"`
	DownloadLocation string            `protobuf:"bytes,5,opt,name=download_location,json=downloadLocation,proto3" json:"download_location,omitempty"`
	MediaType        string            `protobuf:"bytes,6,opt,name=media_type,json=mediaType,proto3" json:"media_type,omitempty"`
	// Per the Struct protobuf spec, this type corresponds to
	// a JSON Object, which is truly a map<string, Value> under the hood.
	// So, the Struct a) is still consistent with our specification for
	// the `annotations` field, and b) has native support in some language
	// bindings making their use easier in implementations.
	// See: https://pkg.go.dev/google.golang.org/protobuf/types/known/structpb#Struct
	Annotations *structpb.Struct `protobuf:"bytes,7,opt,name=annotations,proto3" json:"annotations,omitempty"`
	// contains filtered or unexported fields
}

Proto representation of the in-toto v1 ResourceDescriptor. https://github.com/in-toto/attestation/blob/main/spec/v1/resource_descriptor.md Validation of all fields is left to the users of this proto.

func (*ResourceDescriptor) Descriptor deprecated

func (*ResourceDescriptor) Descriptor() ([]byte, []int)

Deprecated: Use ResourceDescriptor.ProtoReflect.Descriptor instead.

func (*ResourceDescriptor) GetAnnotations

func (x *ResourceDescriptor) GetAnnotations() *structpb.Struct

func (*ResourceDescriptor) GetContent

func (x *ResourceDescriptor) GetContent() []byte

func (*ResourceDescriptor) GetDigest

func (x *ResourceDescriptor) GetDigest() map[string]string

func (*ResourceDescriptor) GetDownloadLocation

func (x *ResourceDescriptor) GetDownloadLocation() string

func (*ResourceDescriptor) GetMediaType

func (x *ResourceDescriptor) GetMediaType() string

func (*ResourceDescriptor) GetName

func (x *ResourceDescriptor) GetName() string

func (*ResourceDescriptor) GetUri

func (x *ResourceDescriptor) GetUri() string

func (*ResourceDescriptor) ProtoMessage

func (*ResourceDescriptor) ProtoMessage()

func (*ResourceDescriptor) ProtoReflect

func (x *ResourceDescriptor) ProtoReflect() protoreflect.Message

func (*ResourceDescriptor) Reset

func (x *ResourceDescriptor) Reset()

func (*ResourceDescriptor) String

func (x *ResourceDescriptor) String() string

func (*ResourceDescriptor) Validate

func (d *ResourceDescriptor) Validate() error

type Statement

type Statement struct {

	// Expected to always be "https://in-toto.io/Statement/v1"
	Type          string                `protobuf:"bytes,1,opt,name=type,json=_type,proto3" json:"type,omitempty"`
	Subject       []*ResourceDescriptor `protobuf:"bytes,2,rep,name=subject,proto3" json:"subject,omitempty"`
	PredicateType string                `protobuf:"bytes,3,opt,name=predicate_type,json=predicateType,proto3" json:"predicate_type,omitempty"`
	Predicate     *structpb.Struct      `protobuf:"bytes,4,opt,name=predicate,proto3" json:"predicate,omitempty"`
	// contains filtered or unexported fields
}

Proto representation of the in-toto v1 Statement. https://github.com/in-toto/attestation/tree/main/spec/v1 Validation of all fields is left to the users of this proto.

func (*Statement) Descriptor deprecated

func (*Statement) Descriptor() ([]byte, []int)

Deprecated: Use Statement.ProtoReflect.Descriptor instead.

func (*Statement) GetPredicate

func (x *Statement) GetPredicate() *structpb.Struct

func (*Statement) GetPredicateType

func (x *Statement) GetPredicateType() string

func (*Statement) GetSubject

func (x *Statement) GetSubject() []*ResourceDescriptor

func (*Statement) GetType

func (x *Statement) GetType() string

func (*Statement) ProtoMessage

func (*Statement) ProtoMessage()

func (*Statement) ProtoReflect

func (x *Statement) ProtoReflect() protoreflect.Message

func (*Statement) Reset

func (x *Statement) Reset()

func (*Statement) String

func (x *Statement) String() string

func (*Statement) Validate

func (s *Statement) Validate() error

Jump to

Keyboard shortcuts

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