config

package
v0.9.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ApplicationName is the name of the application
	ApplicationName = "notation"

	// FileName is the name of config file
	FileName = "config.json"

	// SignatureStoreDirName is the name of the signature store directory
	SignatureStoreDirName = "signature"

	// SignatureExtension defines the extension of the signature files
	SignatureExtension = ".sig"

	// KeyStoreDirName is the name of the key store directory
	KeyStoreDirName = "key"

	// KeyExtension defines the extension of the key files
	KeyExtension = ".key"

	// CertificateStoreDirName is the name of the certificate store directory
	CertificateStoreDirName = "certificate"

	// CertificateExtension defines the extension of the certificate files
	CertificateExtension = ".crt"

	// PluginStoreDirName is the name of the plugin store directory
	PluginStoreDirName = "plugins"
)

Variables

View Source
var (
	// FilePath is the path of config file
	FilePath string

	// SignatureStoreDirPath is the path of the signature store
	SignatureStoreDirPath string

	// KeyStoreDirPath is the path of the key store
	KeyStoreDirPath string

	// CertificateStoreDirPath is the path of the certificate store
	CertificateStoreDirPath string

	// PluginDirPath is the path of the plugin store
	PluginDirPath string
)
View Source
var (
	// ErrKeyNotFound indicates that the signing key is not found.
	ErrKeyNotFound = errors.New("signing key not found")
)

Functions

func CertificatePath

func CertificatePath(name string) string

CertificatePath returns the path of a certificate for verification

func IsRegistryInsecure

func IsRegistryInsecure(target string) bool

IsRegistryInsecure checks whether the registry is in the list of insecure registries.

func KeyPath

func KeyPath(name string) string

KeyPath returns the path of a signing key

func SignaturePath

func SignaturePath(manifestDigest, signatureDigest digest.Digest) string

SignaturePath returns the path of a signature for a manifest

func SignatureRootPath

func SignatureRootPath(manifestDigest digest.Digest) string

SignatureRootPath returns the root path of signatures for a manifest

Types

type CertificateReference

type CertificateReference struct {
	Name string `json:"name"`
	Path string `json:"path"`
}

CertificateReference is a named file path.

func (CertificateReference) Is

func (c CertificateReference) Is(name string) bool

type ExternalKey

type ExternalKey struct {
	ID           string            `json:"id,omitempty"`
	PluginName   string            `json:"pluginName,omitempty"`
	PluginConfig map[string]string `json:"pluginConfig,omitempty"`
}

ExternalKey contains the necessary information to delegate the signing operation to the named plugin.

type File

type File struct {
	VerificationCertificates VerificationCertificates `json:"verificationCerts"`
	SigningKeys              SigningKeys              `json:"signingKeys,omitempty"`
	InsecureRegistries       []string                 `json:"insecureRegistries"`
}

File reflects the config file. Specification: https://github.com/notaryproject/notation/pull/76

func Load

func Load() (*File, error)

Load reads the config from file

func LoadOrDefault

func LoadOrDefault() (*File, error)

LoadOrDefault reads the config from file or return a default config if not found.

func LoadOrDefaultOnce

func LoadOrDefaultOnce() (*File, error)

LoadOrDefaultOnce returns the previously read config file. If previous config file does not exists, it reads the config from file or return a default config if not found. The returned config is only suitable for read only scenarios for short-lived processes.

func New

func New() *File

New creates a new config file

func (*File) Save

func (f *File) Save() error

Save stores the config to file

type KeySuite

type KeySuite struct {
	Name string `json:"name"`

	*X509KeyPair
	*ExternalKey
}

KeySuite is a named key suite.

func ResolveKey

func ResolveKey(name string) (KeySuite, error)

ResolveKey resolves the key by name. The default key is attempted if name is empty.

func (KeySuite) Is

func (k KeySuite) Is(name string) bool

type SigningKeys

type SigningKeys struct {
	Default string     `json:"default"`
	Keys    []KeySuite `json:"keys"`
}

SigningKeys is a collection of signing keys.

type VerificationCertificates

type VerificationCertificates struct {
	Certificates []CertificateReference `json:"certs"`
}

VerificationCertificates is a collection of public certs used for verification.

type X509KeyPair

type X509KeyPair struct {
	KeyPath         string `json:"keyPath,omitempty"`
	CertificatePath string `json:"certPath,omitempty"`
}

X509KeyPair contains the paths of a public/private key pair files.

Jump to

Keyboard shortcuts

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