config

package
v0.0.0-...-a53ccdd Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONFIG_MODE_KEYPAIR = "keypair"
	CONFIG_MODE_KEYLESS = "keyless"
)
View Source
const (
	OICD_ISSUER = "https://oauth2.sigstore.dev/auth"
	REKOR_URL   = "https://rekor.sigstore.dev"
)
View Source
const CONFIG_FILE_NAME = "sigrun-config.json"
View Source
const LEDGER_FILE_NAME = "sigrun-ledger.json"

Variables

This section is empty.

Functions

func GetGUID

func GetGUID(path string) (string, error)

func GetGUIDFromConfigFile

func GetGUIDFromConfigFile(path string) (string, error)

func NormalizeImageName

func NormalizeImageName(image string) (string, error)

func ReadRepos

func ReadRepos(repoUrls ...string) (map[string]Config, error)

TODO should be repo urls, currentl config file urls

func ReadReposFromPath

func ReadReposFromPath(repoFilePaths ...string) (map[string]Config, error)

TODO should be repo urls, currentl config file urls

Types

type Checksum

type Checksum struct {
	Path     string
	Hash     string
	Children []*Checksum `json:"children,omitempty"`
}

func NewChecksum

func NewChecksum(path string) (*Checksum, error)

type Config

type Config interface {
	InitializeRepository(repoPath string) error
	SignImages(repoPath string, annotations map[string]string) error
	Sign([]byte) (string, error)
	GetVerificationInfo() *VerificationInfo
	VerifyImage(image string) error
}

TODO Improper abstraction - too many things in common. Abstract only what is needed.

func GetVerificationConfigFromVerificationInfo

func GetVerificationConfigFromVerificationInfo(info *VerificationInfo) Config

func ReadRepositoryConfig

func ReadRepositoryConfig() (Config, error)

type GitCommitObject

type GitCommitObject struct {
	Hash     string
	Message  string
	Author   string
	UnixTime int64
}

type ImageInfo

type ImageInfo struct {

	// Registry is the URL address of the image registry e.g. `docker.io`
	Registry string `json:"registry,omitempty"`

	// Name is the image name portion e.g. `busybox`
	Name string `json:"name"`

	// Path is the repository path and image name e.g. `some-repository/busybox`
	Path string `json:"path"`

	// Tag is the image tag e.g. `v2`
	Tag string `json:"tag,omitempty"`

	// Digest is the image digest portion e.g. `sha256:128c6e3534b842a2eec139999b8ce8aa9a2af9907e2b9269550809d18cd832a3`
	Digest string `json:"digest,omitempty"`
}

func (*ImageInfo) String

func (i *ImageInfo) String() string

type KeyPair

type KeyPair struct {
	Name       string
	Mode       string
	PublicKey  string
	PrivateKey string
	Images     []string
}

func NewKeypairConfig

func NewKeypairConfig(name, pubKey, privKey string, images []string) *KeyPair

func (*KeyPair) GetVerificationInfo

func (conf *KeyPair) GetVerificationInfo() *VerificationInfo

func (*KeyPair) InitializeRepository

func (conf *KeyPair) InitializeRepository(repoPath string) error

func (*KeyPair) Sign

func (conf *KeyPair) Sign(data []byte) (string, error)

func (*KeyPair) SignImages

func (conf *KeyPair) SignImages(repoPath string, annotations map[string]string) error

func (*KeyPair) VerifyImage

func (conf *KeyPair) VerifyImage(image string) error

type Keyless

type Keyless struct {
	Name        string
	Mode        string
	Maintainers []string
	Images      []string
}

func NewKeylessConfig

func NewKeylessConfig(name string, maintainers, images []string) *Keyless

func (*Keyless) GetVerificationInfo

func (conf *Keyless) GetVerificationInfo() *VerificationInfo

func (*Keyless) InitializeRepository

func (conf *Keyless) InitializeRepository(repoPath string) error

func (*Keyless) Sign

func (conf *Keyless) Sign(msg []byte) (string, error)

func (*Keyless) SignImages

func (conf *Keyless) SignImages(repoPath string, annotations map[string]string) error

func (*Keyless) VerifyImage

func (conf *Keyless) VerifyImage(image string) error

type Ledger

type Ledger struct {
	Entries []*LedgerEntry
}

func NewLedger

func NewLedger() *Ledger

func (*Ledger) AddEntry

func (l *Ledger) AddEntry(annotations map[string]string) error

type LedgerEntry

type LedgerEntry struct {
	Id          int
	Git         GitCommitObject
	Hash        string
	Timestamp   string
	Annotations map[string]string
	Checksum    *Checksum
}

type VerificationInfo

type VerificationInfo struct {
	Name        string
	Mode        string
	PublicKey   string
	Maintainers []string
	Images      []string
}

Jump to

Keyboard shortcuts

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