package v1
import "github.com/in-toto/attestation/go/v1"
Index ¶
- Constants
- Variables
- type HashAlgorithm
- type ResourceDescriptor
- func (*ResourceDescriptor) Descriptor() ([]byte, []int)
- func (x *ResourceDescriptor) GetAnnotations() *structpb.Struct
- func (x *ResourceDescriptor) GetContent() []byte
- func (x *ResourceDescriptor) GetDigest() map[string]string
- func (x *ResourceDescriptor) GetDownloadLocation() string
- func (x *ResourceDescriptor) GetMediaType() string
- func (x *ResourceDescriptor) GetName() string
- func (x *ResourceDescriptor) GetUri() string
- func (*ResourceDescriptor) ProtoMessage()
- func (x *ResourceDescriptor) ProtoReflect() protoreflect.Message
- func (x *ResourceDescriptor) Reset()
- func (x *ResourceDescriptor) String() string
- func (d *ResourceDescriptor) Validate() error
- type Statement
- func (*Statement) Descriptor() ([]byte, []int)
- func (x *Statement) GetPredicate() *structpb.Struct
- func (x *Statement) GetPredicateType() string
- func (x *Statement) GetSubject() []*ResourceDescriptor
- func (x *Statement) GetType() string
- func (*Statement) ProtoMessage()
- func (x *Statement) ProtoReflect() protoreflect.Message
- func (x *Statement) Reset()
- func (x *Statement) String() string
- func (s *Statement) Validate() error
Constants ¶
const StatementTypeUri = "https://in-toto.io/Statement/v1"
Variables ¶
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") )
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") )
var File_in_toto_attestation_v1_resource_descriptor_proto protoreflect.FileDescriptor
var File_in_toto_attestation_v1_statement_proto protoreflect.FileDescriptor
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
Types ¶
type HashAlgorithm ¶
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 ¶
func (algo HashAlgorithm) HexLength() int
HexLength returns the expected length of an algorithm's hash when hexencoded
func (HashAlgorithm) String ¶
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 `protobuf:"bytes,3,rep,name=digest,proto3" json:"digest,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
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 ¶
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: Use Statement.ProtoReflect.Descriptor instead.
func (*Statement) GetPredicate ¶
func (*Statement) GetPredicateType ¶
func (*Statement) GetSubject ¶
func (x *Statement) GetSubject() []*ResourceDescriptor
func (*Statement) GetType ¶
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 (*Statement) Validate ¶
Source Files ¶
resource_descriptor.go resource_descriptor.pb.go statement.go statement.pb.go
- Version
- v1.1.2 (latest)
- Published
- Jun 13, 2025
- Platform
- linux/amd64
- Imports
- 9 packages
- Last checked
- 4 months ago –
Tools for package owners.