config

package
v0.10.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: Apache-2.0 Imports: 6 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ConfigPath is the path for config.json
	ConfigPath string
	// SigningKeysPath is the path for signingkeys.json
	SigningKeysPath string
)

Functions

This section is empty.

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

Is checks whether the given name is equal with the Name variable

type Config

type Config struct {
	VerificationCertificates VerificationCertificates `json:"verificationCerts"`
	InsecureRegistries       []string                 `json:"insecureRegistries"`
	CredentialsStore         string                   `json:"credsStore,omitempty"`
	CredentialHelpers        map[string]string        `json:"credHelpers,omitempty"`
}

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

func LoadConfig

func LoadConfig() (*Config, error)

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

func NewConfig

func NewConfig() *Config

NewConfig creates a new config file

func (*Config) Save

func (c *Config) Save() error

Save stores the config to file

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 KeySuite

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

	*X509KeyPair
	*ExternalKey
}

KeySuite is a named key suite.

func (KeySuite) Is

func (k KeySuite) Is(name string) bool

Is checks whether the given name is equal with the Name variable

type SigningKeys

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

SigningKeys reflects the signingkeys.json file.

func LoadSigningKeys

func LoadSigningKeys() (*SigningKeys, error)

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

func NewSigningKeys

func NewSigningKeys() *SigningKeys

NewSigningKeys creates a new signingkeys config file

func (*SigningKeys) Save

func (s *SigningKeys) Save() error

Save config to file

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