Documentation ¶
Index ¶
- Variables
- func CanonicalizeEntry(ctx context.Context, entry EntryImpl) ([]byte, error)
- func DecodeEntry(input, output interface{}) error
- func ListImplementedTypes() []string
- func NewProposedEntry(ctx context.Context, kind, version string, props ArtifactProperties) (models.ProposedEntry, error)
- func PipeCloser(errClosers ...errCloser) func(err error) error
- type ArtifactProperties
- type BaseProposedEntryTester
- type BaseUnmarshalTester
- func (u BaseUnmarshalTester) APIVersion() string
- func (u BaseUnmarshalTester) AttestationKey() string
- func (u BaseUnmarshalTester) AttestationKeyValue() (string, []byte)
- func (u BaseUnmarshalTester) Canonicalize(ctx context.Context) ([]byte, error)
- func (u BaseUnmarshalTester) CreateFromArtifactProperties(_ context.Context, _ ArtifactProperties) (models.ProposedEntry, error)
- func (u BaseUnmarshalTester) IndexKeys() ([]string, error)
- func (u BaseUnmarshalTester) NewEntry() EntryImpl
- func (u BaseUnmarshalTester) Unmarshal(pe models.ProposedEntry) error
- func (u BaseUnmarshalTester) Validate() error
- type EntryFactory
- type EntryImpl
- type EntryWithAttestationImpl
- type RekorType
- type SemVerEntryFactoryMap
- type TypeImpl
- type ValidationError
- type VersionEntryFactoryMap
Constants ¶
This section is empty.
Variables ¶
var TypeMap sync.Map
TypeMap stores mapping between type strings and entry constructors entries are written once at process initialization and read for each transaction, so we use sync.Map which is optimized for this case
Functions ¶
func CanonicalizeEntry ¶ added in v0.4.0
CanonicalizeEntry returns the entry marshalled in JSON according to the canonicalization rules of RFC8785 to protect against any changes in golang's JSON marshalling logic that may reorder elements
func DecodeEntry ¶ added in v0.2.0
func DecodeEntry(input, output interface{}) error
DecodeEntry maps the (abstract) input structure into the specific entry implementation class; while doing so, it detects the case where we need to convert from string to []byte and does the base64 decoding required to make that happen. This also detects converting from string to strfmt.DateTime
func ListImplementedTypes ¶ added in v0.3.0
func ListImplementedTypes() []string
ListImplementedTypes returns a list of all type strings currently known to be implemented
func NewProposedEntry ¶ added in v0.3.0
func NewProposedEntry(ctx context.Context, kind, version string, props ArtifactProperties) (models.ProposedEntry, error)
func PipeCloser ¶ added in v0.5.0
Types ¶
type ArtifactProperties ¶ added in v0.3.0
type ArtifactProperties struct { AdditionalAuthenticatedData []byte ArtifactPath *url.URL ArtifactHash string ArtifactBytes []byte SignaturePath *url.URL SignatureBytes []byte PublicKeyPath *url.URL PublicKeyBytes []byte PKIFormat string }
ArtifactProperties provide a consistent struct for passing values from CLI flags to the type+version specific CreateProposeEntry() methods
type BaseProposedEntryTester ¶ added in v0.9.0
type BaseProposedEntryTester struct{}
func (BaseProposedEntryTester) ContextValidate ¶ added in v0.9.0
func (BaseProposedEntryTester) Kind ¶ added in v0.9.0
func (b BaseProposedEntryTester) Kind() string
func (BaseProposedEntryTester) SetKind ¶ added in v0.9.0
func (b BaseProposedEntryTester) SetKind(v string)
type BaseUnmarshalTester ¶ added in v0.5.0
type BaseUnmarshalTester struct{}
func (BaseUnmarshalTester) APIVersion ¶ added in v0.5.0
func (u BaseUnmarshalTester) APIVersion() string
func (BaseUnmarshalTester) AttestationKey ¶ added in v0.7.0
func (u BaseUnmarshalTester) AttestationKey() string
func (BaseUnmarshalTester) AttestationKeyValue ¶ added in v0.7.0
func (u BaseUnmarshalTester) AttestationKeyValue() (string, []byte)
func (BaseUnmarshalTester) Canonicalize ¶ added in v0.5.0
func (u BaseUnmarshalTester) Canonicalize(ctx context.Context) ([]byte, error)
func (BaseUnmarshalTester) CreateFromArtifactProperties ¶ added in v0.5.0
func (u BaseUnmarshalTester) CreateFromArtifactProperties(_ context.Context, _ ArtifactProperties) (models.ProposedEntry, error)
func (BaseUnmarshalTester) IndexKeys ¶ added in v0.5.0
func (u BaseUnmarshalTester) IndexKeys() ([]string, error)
func (BaseUnmarshalTester) NewEntry ¶ added in v0.5.0
func (u BaseUnmarshalTester) NewEntry() EntryImpl
func (BaseUnmarshalTester) Unmarshal ¶ added in v0.5.0
func (u BaseUnmarshalTester) Unmarshal(pe models.ProposedEntry) error
func (BaseUnmarshalTester) Validate ¶ added in v0.5.0
func (u BaseUnmarshalTester) Validate() error
type EntryFactory ¶ added in v0.2.0
type EntryFactory func() EntryImpl
EntryFactory describes a factory function that can generate structs for a specific versioned type
type EntryImpl ¶
type EntryImpl interface { APIVersion() string // the supported versions for this implementation IndexKeys() ([]string, error) // the keys that should be added to the external index for this entry Canonicalize(ctx context.Context) ([]byte, error) // marshal the canonical entry to be put into the tlog Unmarshal(e models.ProposedEntry) error // unmarshal the abstract entry into the specific struct for this versioned type CreateFromArtifactProperties(context.Context, ArtifactProperties) (models.ProposedEntry, error) }
EntryImpl specifies the behavior of a versioned type
type EntryWithAttestationImpl ¶ added in v0.9.1
type EntryWithAttestationImpl interface { EntryImpl AttestationKey() string // returns the key used to look up the attestation from storage (should be sha256:digest) AttestationKeyValue() (string, []byte) // returns the key to be used when storing the attestation as well as the attestation itself }
EntryWithAttestationImpl specifies the behavior of a versioned type that also stores attestations
type RekorType ¶ added in v0.2.0
type RekorType struct { Kind string // this is the unique string that identifies the type VersionMap VersionEntryFactoryMap // this maps the supported versions to implementation }
RekorType is the base struct that is embedded in all type implementations
func (*RekorType) SupportedVersions ¶ added in v0.3.0
func (*RekorType) VersionedUnmarshal ¶ added in v0.2.0
VersionedUnmarshal extracts the correct implementing factory function from the type's version map, creates an entry of that versioned type and then calls that versioned type's unmarshal method
type SemVerEntryFactoryMap ¶ added in v0.2.0
SemVerEntryFactoryMap implements a map that allows implementations to specify their supported versions using semver-compliant strings
func (*SemVerEntryFactoryMap) Count ¶ added in v0.2.0
func (s *SemVerEntryFactoryMap) Count() int
func (*SemVerEntryFactoryMap) GetEntryFactory ¶ added in v0.2.0
func (s *SemVerEntryFactoryMap) GetEntryFactory(version string) (EntryFactory, error)
func (*SemVerEntryFactoryMap) SetEntryFactory ¶ added in v0.2.0
func (s *SemVerEntryFactoryMap) SetEntryFactory(constraint string, ef EntryFactory) error
func (*SemVerEntryFactoryMap) SupportedVersions ¶ added in v0.3.0
func (s *SemVerEntryFactoryMap) SupportedVersions() []string
type TypeImpl ¶
type TypeImpl interface { CreateProposedEntry(context.Context, string, ArtifactProperties) (models.ProposedEntry, error) DefaultVersion() string SupportedVersions() []string UnmarshalEntry(pe models.ProposedEntry) (EntryImpl, error) }
TypeImpl is implemented by all types to support the polymorphic conversion of abstract proposed entry to a working implementation for the versioned type requested, if supported
type ValidationError ¶ added in v0.3.0
type ValidationError error
ValidationError indicates that there is an issue with the content in the HTTP Request that should result in an HTTP 400 Bad Request error being returned to the client
type VersionEntryFactoryMap ¶ added in v0.2.0
type VersionEntryFactoryMap interface { GetEntryFactory(string) (EntryFactory, error) // return the entry factory for the specified version SetEntryFactory(string, EntryFactory) error // set the entry factory for the specified version Count() int // return the count of entry factories currently in the map SupportedVersions() []string // return a list of versions currently stored in the map }
VersionEntryFactoryMap defines a map-like interface to find the correct implementation for a version string This could be a simple map[string]EntryFactory, or something more elegant (e.g. semver)
func NewSemVerEntryFactoryMap ¶ added in v0.2.0
func NewSemVerEntryFactoryMap() VersionEntryFactoryMap