Documentation ¶
Overview ¶
Package config provides the ability to load and save config.json and signingkeys.json.
Index ¶
- func LoadExecSaveSigningKeys(fn func(keys *SigningKeys) error) error
- type Config
- type ExternalKey
- type KeySuite
- type SigningKeys
- func (s *SigningKeys) Add(name, keyPath, certPath string, markDefault bool) error
- func (s *SigningKeys) AddPlugin(ctx context.Context, keyName, id, pluginName string, ...) error
- func (s *SigningKeys) Get(keyName string) (KeySuite, error)
- func (s *SigningKeys) GetDefault() (KeySuite, error)
- func (s *SigningKeys) Remove(keyName ...string) ([]string, error)
- func (s *SigningKeys) Save() error
- func (s *SigningKeys) UpdateDefault(keyName string) error
- type X509KeyPair
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadExecSaveSigningKeys ¶
func LoadExecSaveSigningKeys(fn func(keys *SigningKeys) error) error
LoadExecSaveSigningKeys loads signing key, executes given function and then saves the signing key
Types ¶
type Config ¶
type Config struct { InsecureRegistries []string `json:"insecureRegistries"` CredentialsStore string `json:"credsStore,omitempty"` CredentialHelpers map[string]string `json:"credHelpers,omitempty"` // SignatureFormat defines the signature envelope type for signing SignatureFormat string `json:"signatureFormat,omitempty"` }
Config reflects the config.json file. Specification: https://github.com/notaryproject/notation/pull/76
func LoadConfig ¶
LoadConfig reads the config from file or return a default config if not found.
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.
type SigningKeys ¶
type SigningKeys struct { Default *string `json:"default,omitempty"` Keys []KeySuite `json:"keys"` }
SigningKeys reflects the signingkeys.json file.
func LoadSigningKeys ¶
func LoadSigningKeys() (*SigningKeys, error)
LoadSigningKeys reads the signingkeys.json file or return a default config if not found.
func NewSigningKeys ¶
func NewSigningKeys() *SigningKeys
NewSigningKeys creates a new signingkeys config file
func (*SigningKeys) Add ¶
func (s *SigningKeys) Add(name, keyPath, certPath string, markDefault bool) error
Add adds new signing key
func (*SigningKeys) AddPlugin ¶
func (s *SigningKeys) AddPlugin(ctx context.Context, keyName, id, pluginName string, pluginConfig map[string]string, markDefault bool) error
AddPlugin adds new plugin based signing key
func (*SigningKeys) Get ¶
func (s *SigningKeys) Get(keyName string) (KeySuite, error)
Get returns signing key for the given name
func (*SigningKeys) GetDefault ¶
func (s *SigningKeys) GetDefault() (KeySuite, error)
GetDefault returns default signing key
func (*SigningKeys) Remove ¶
func (s *SigningKeys) Remove(keyName ...string) ([]string, error)
Remove deletes given signing keys and returns a slice of deleted key names
func (*SigningKeys) Save ¶
func (s *SigningKeys) Save() error
Save SigningKeys to signingkeys.json file
func (*SigningKeys) UpdateDefault ¶
func (s *SigningKeys) UpdateDefault(keyName string) error
UpdateDefault updates default signing key
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.