Documentation ¶
Index ¶
- type TrustedMetadata
- func (trusted *TrustedMetadata) UpdateDelegatedTargets(targetsData []byte, roleName, delegatorName string) (*metadata.Metadata[metadata.TargetsType], error)
- func (trusted *TrustedMetadata) UpdateRoot(rootData []byte) (*metadata.Metadata[metadata.RootType], error)
- func (trusted *TrustedMetadata) UpdateSnapshot(snapshotData []byte, isTrusted bool) (*metadata.Metadata[metadata.SnapshotType], error)
- func (trusted *TrustedMetadata) UpdateTargets(targetsData []byte) (*metadata.Metadata[metadata.TargetsType], error)
- func (trusted *TrustedMetadata) UpdateTimestamp(timestampData []byte) (*metadata.Metadata[metadata.TimestampType], error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TrustedMetadata ¶
type TrustedMetadata struct { Root *metadata.Metadata[metadata.RootType] Snapshot *metadata.Metadata[metadata.SnapshotType] Timestamp *metadata.Metadata[metadata.TimestampType] Targets map[string]*metadata.Metadata[metadata.TargetsType] RefTime time.Time }
TrustedMetadata struct for storing trusted metadata
func New ¶
func New(rootData []byte) (*TrustedMetadata, error)
New creates a new TrustedMetadata instance which ensures that the collection of metadata in it is valid and trusted through the whole client update workflow. It provides easy ways to update the metadata with the caller making decisions on what is updated
func (*TrustedMetadata) UpdateDelegatedTargets ¶
func (trusted *TrustedMetadata) UpdateDelegatedTargets(targetsData []byte, roleName, delegatorName string) (*metadata.Metadata[metadata.TargetsType], error)
UpdateDelegatedTargets verifies and loads “targetsData“ as new metadata for target “roleName“
func (*TrustedMetadata) UpdateRoot ¶
func (trusted *TrustedMetadata) UpdateRoot(rootData []byte) (*metadata.Metadata[metadata.RootType], error)
UpdateRoot verifies and loads “rootData“ as new root metadata. Note that an expired intermediate root is considered valid: expiry is only checked for the final root in UpdateTimestamp()
func (*TrustedMetadata) UpdateSnapshot ¶
func (trusted *TrustedMetadata) UpdateSnapshot(snapshotData []byte, isTrusted bool) (*metadata.Metadata[metadata.SnapshotType], error)
UpdateSnapshot verifies and loads “snapshotData“ as new snapshot metadata. Note that an intermediate snapshot is allowed to be expired and version is allowed to not match timestamp meta version: TrustedMetadata will error for case of expired metadata or when using bad versions but the intermediate snapshot will be loaded. This way a newer snapshot can still be loaded (and the intermediate snapshot will be used for rollback protection). Expired snapshot or snapshot that does not match timestamp meta version will prevent loading targets.
func (*TrustedMetadata) UpdateTargets ¶
func (trusted *TrustedMetadata) UpdateTargets(targetsData []byte) (*metadata.Metadata[metadata.TargetsType], error)
UpdateTargets verifies and loads “targetsData“ as new top-level targets metadata.
func (*TrustedMetadata) UpdateTimestamp ¶
func (trusted *TrustedMetadata) UpdateTimestamp(timestampData []byte) (*metadata.Metadata[metadata.TimestampType], error)
UpdateTimestamp verifies and loads “timestampData“ as new timestamp metadata. Note that an intermediate timestamp is allowed to be expired. "TrustedMetadata" will error in this case but the intermediate timestamp will be loaded. This way a newer timestamp can still be loaded (and the intermediate timestamp will be used for rollback protection). Expired timestamp will prevent loading snapshot metadata.