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) ArtifactHash() (string, error)
- func (u BaseUnmarshalTester) AttestationKey() string
- func (u BaseUnmarshalTester) AttestationKeyValue() (string, []byte)
- func (u BaseUnmarshalTester) Canonicalize(_ context.Context) ([]byte, error)
- func (u BaseUnmarshalTester) CreateFromArtifactProperties(_ context.Context, _ ArtifactProperties) (models.ProposedEntry, error)
- func (u BaseUnmarshalTester) IndexKeys() ([]string, error)
- func (u BaseUnmarshalTester) Insertable() (bool, error)
- func (u BaseUnmarshalTester) NewEntry() EntryImpl
- func (u BaseUnmarshalTester) Unmarshal(_ models.ProposedEntry) error
- func (u BaseUnmarshalTester) Validate() error
- func (u BaseUnmarshalTester) Verifiers() ([]pki.PublicKey, error)
- type EntryFactory
- type EntryImpl
- type EntryWithAttestationImpl
- type ProposedEntryIterator
- 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 PublicKeyPaths []*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(_ 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) ArtifactHash ¶ added in v1.3.3
func (u BaseUnmarshalTester) ArtifactHash() (string, error)
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(_ 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) Insertable ¶ added in v1.2.0
func (u BaseUnmarshalTester) Insertable() (bool, 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(_ 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) Verifiers() ([]pki.PublicKey, error) // list of keys or certificates that can verify an entry's signature ArtifactHash() (string, error) // hex-encoded artifact hash prefixed with hash name, e.g. sha256:abcdef Insertable() (bool, error) // denotes whether the entry that was unmarshalled has the writeOnly fields required to validate and insert into the log }
EntryImpl specifies the behavior of a versioned type
func CreateVersionedEntry ¶ added in v0.12.0
func CreateVersionedEntry(pe models.ProposedEntry) (EntryImpl, error)
CreateVersionedEntry returns the specific instance for the type and version specified in the doc This method should be used on the insertion flow, which validates that the specific version proposed is permitted to be entered into the log.
func UnmarshalEntry ¶ added in v0.12.0
func UnmarshalEntry(pe models.ProposedEntry) (EntryImpl, error)
UnmarshalEntry returns the specific instance for the type and version specified in the doc This method does not check for whether the version of the entry could be currently inserted into the log, and is useful when dealing with entries that have been persisted to the log.
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 ProposedEntryIterator ¶ added in v0.12.1
type ProposedEntryIterator interface { models.ProposedEntry HasNext() bool Get() models.ProposedEntry GetNext() models.ProposedEntry }
ProposedEntryIterator is an iterator over a list of proposed entries
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) IsSupportedVersion ¶ added in v0.12.0
IsSupportedVersion returns true if the version can be inserted into the log, and false if not
func (*RekorType) SupportedVersions ¶ added in v0.3.0
SupportedVersions returns a list of versions of this type that can be currently entered into the log
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 IsSupportedVersion(string) bool 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