repo

package
v0.0.0-...-bbc9ce3 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: BSD-2-Clause Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OutOfRangeError = errors.New("out of range")
)

Functions

func AddFromConfig

func AddFromConfig(ctx context.Context, client *sshutil.Client, config *Config) error

AddFromConfig writes the given config to the given remote install path and adds it as an update source.

Types

type Config

type Config struct {
	URL              string                `json:"repo_url"`
	RootKeys         []KeyConfig           `json:"root_keys"`
	Mirrors          []MirrorConfig        `json:"mirrors"`
	RootVersion      uint32                `json:"root_version"`
	RootThreshold    uint32                `json:"root_threshold"`
	UpdatePackageURL string                `json:"update_package_url,omitempty"`
	UseLocalMirror   bool                  `json:"use_local_mirror,omitempty"`
	StorageType      RepositoryStorageType `json:"storage_type,omitempty"`
}

Config is a struct that mirrors an associated FIDL table definition in //sdk/fidl/fuchsia.pkg/repo.fidl. Documentation is as in that file. Ditto for the types that comprise its definition.

Keep these in sync with their repo.fidl counterparts as well as the custom

func (*Config) MarshalJSON

func (cfg *Config) MarshalJSON() ([]byte, error)

func (*Config) UnmarshalJSON

func (cfg *Config) UnmarshalJSON(data []byte) error

type KeyConfig

type KeyConfig struct {
	// ED25519Key is a 32-byte, lowercase, hex-encoded key.
	ED25519Key string
}

func GetRootKeys

func GetRootKeys(root *tuf_data.Root) ([]KeyConfig, error)

GetRootKeys returns the list of public key config objects as read from the contents of a repository's root metadata file.

func (*KeyConfig) MarshalJSON

func (key *KeyConfig) MarshalJSON() ([]byte, error)

func (*KeyConfig) UnmarshalJSON

func (key *KeyConfig) UnmarshalJSON(data []byte) error

type MirrorConfig

type MirrorConfig struct {
	URL       string `json:"mirror_url"`
	Subscribe bool   `json:"subscribe"`
	BlobURL   string `json:"blob_mirror_url,omitempty"`
}

type RepositoryStorageType

type RepositoryStorageType uint32

The underlying type of the FIDL RepositoryStorageType is uint32, see //sdk/fidl/fuchsia.pkg/repo.fidl and https://fuchsia.dev/fuchsia-src/reference/fidl/language/language#enums

const (
	Unset RepositoryStorageType = iota
	Ephemeral
	Persistent
)

func (RepositoryStorageType) MarshalJSON

func (t RepositoryStorageType) MarshalJSON() ([]byte, error)

func (*RepositoryStorageType) UnmarshalJSON

func (t *RepositoryStorageType) UnmarshalJSON(b []byte) error

type RootMetadata

type RootMetadata struct {
	// RootKeys is the list of public key config objects from a package
	// repository.
	RootKeys []KeyConfig

	// RootVersion is the root version of the repository
	RootVersion uint32

	// RootThreshold is how many signatures the root metadata needs before
	// it is considered valid.
	RootThreshold uint32
}

RootMetadata describes the package repository root metadata.

func GetRootMetadataInsecurely

func GetRootMetadataInsecurely(ctx context.Context, repoURL string) (RootMetadata, error)

GetRootMetadataInsecurely returns the TUF root metadata. Note this is an insecure method, as it leaves the caller open to a man-in-the-middle attack.

Jump to

Keyboard shortcuts

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