config

package
v0.7.1-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2021 License: Apache-2.0 Imports: 7 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"
)

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
)
View Source
var (
	// ErrKeyNotFound indicates that the signing key is not found.
	ErrKeyNotFound = errors.New("signing key not found")

	// ErrCertificateNotFound indicates that the verification certificate is not found.
	ErrCertificateNotFound = errors.New("verification certificate 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 ResolveCertificatePath

func ResolveCertificatePath(name string) (string, error)

ResolveCertificatePath resolves the certificate path by name.

func ResolveKeyPath

func ResolveKeyPath(name string) (string, string, error)

ResolveKeyPath resolves the key path by name along with its corresponding certificate path. The default key is attempted if name is empty.

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 CertificateMap

type CertificateMap []CertificateReference

CertificateMap is a set of CertificateReference indexed by name. The overall performance is O(n) while the order of entries is persevered.

func (*CertificateMap) Append

func (m *CertificateMap) Append(name, path string) bool

Append appends a uniquely named path to the map. Return true if new values are appended.

func (CertificateMap) Get

func (m CertificateMap) Get(name string) (string, bool)

Get return the path of the given name. Return true if found.

func (*CertificateMap) Remove

func (m *CertificateMap) Remove(name string) bool

Remove removes a named path from the map. Return true if an entry is found and removed.

type CertificateReference

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

CertificateReference is a named file path.

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 KeyMap

type KeyMap []KeySuite

KeyMap is a set of KeySuite indexed by name. The overall performance is O(n) while the order of entries is persevered.

func (*KeyMap) Append

func (m *KeyMap) Append(name, keyPath, certPath string) bool

Append appends a uniquely named KeySuite to the map. Return true if new values are appended.

func (KeyMap) Get

func (m KeyMap) Get(name string) (string, string, bool)

Get return the paths of the given name. Return true if found.

func (*KeyMap) Remove

func (m *KeyMap) Remove(name string) bool

Remove removes a named path from the map. Return true if an entry is found and removed.

type KeySuite

type KeySuite struct {
	Name            string `json:"name"`
	KeyPath         string `json:"keyPath"`
	CertificatePath string `json:"certPath"`
}

KeySuite is a named key suite with file paths.

type SigningKeys

type SigningKeys struct {
	Default string `json:"default"`
	Keys    KeyMap `json:"keys"`
}

SigningKeys is a collection of signing keys.

type VerificationCertificates

type VerificationCertificates struct {
	Certificates CertificateMap `json:"certs"`
}

VerificationCertificates is a collection of public certs used for verification.

Jump to

Keyboard shortcuts

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