Documentation
¶
Index ¶
- Constants
- func TrimPrivKey(privKey string) string
- func TrimPubKey(pubKey string) string
- type Cryptor
- type EncryptedSecretFile
- type EncryptedSecretFiles
- type EncryptedSecrets
- type Option
- func WithConfirmationReader(reader util.ConsoleReader) Option
- func WithConsoleReader(reader util.ConsoleReader) Option
- func WithConsoleWriter(writer util.ConsoleWriter) Option
- func WithDetectGitDir() Option
- func WithGeneratedEd25519Keys(projectName, profile string) Option
- func WithGeneratedKeys(projectName, profile string) Option
- func WithGitRepo(gitRepo git.Repo) Option
- func WithKeysFromCurrentProfile() Option
- func WithKeysFromScConfig(profile string) Option
- func WithPrivateKey(key string) Option
- func WithPrivateKeyPath(filePath string) Option
- func WithProfile(profile string) Option
- func WithPublicKey(key string) Option
- func WithPublicKeyPath(filePath string) Option
- func WithWorkDir(wd string) Option
- type Registry
- type SshKey
Constants ¶
View Source
const EncryptedSecretFilesDataFileName = "secrets.yaml"
Variables ¶
This section is empty.
Functions ¶
func TrimPrivKey ¶
func TrimPubKey ¶
TrimPubKey normalizes SSH public keys by ignoring aliases/comments SSH keys have format: <key-type> <key-data> optional-comment/alias We only keep the key-type and key-data parts to ensure keys with different aliases but same key data are treated identically for encryption/decryption
Types ¶
type Cryptor ¶
type Cryptor interface {
GenerateKeyPairWithProfile(projectName, profile string) error
GenerateEd25519KeyPairWithProfile(projectName, profile string) error
ReadProfileConfig() error
AddFile(path string) error
RemoveFile(path string) error
DecryptAll(forceChanged bool) error
EncryptChanged(force bool, forceChanged bool) error
ReadSecretFiles() error
MarshalSecretsFile() error
GetSecretFiles() EncryptedSecretFiles
GetAndDecryptFileContent(relPath string) ([]byte, error)
PublicKey() string
PrivateKey() string
Workdir() string
// AddPublicKey allow another public key to encrypt secrets
AddPublicKey(pubKey string) error
// RemovePublicKey remove public key from encrypting secrets
RemovePublicKey(pubKey string) error
// GetKnownPublicKeys return all public keys
GetKnownPublicKeys() []string
Options() []Option
GitRepo() git.Repo
}
type EncryptedSecretFile ¶
type EncryptedSecretFiles ¶
type EncryptedSecretFiles struct {
Registry Registry `json:"registry" yaml:"registry"`
Secrets map[string]EncryptedSecrets `json:"secrets" yaml:"secrets"`
}
type EncryptedSecrets ¶
type EncryptedSecrets struct {
Files []EncryptedSecretFile `json:"secrets" yaml:"secrets"`
PublicKey SshKey `json:"publicKeys" yaml:"publicKeys"`
// not to be serialized
PrivateKey SshKey `json:"-" yaml:"-"`
}
func (*EncryptedSecrets) AddFileIfNotExist ¶
func (es *EncryptedSecrets) AddFileIfNotExist(f EncryptedSecretFile)
func (*EncryptedSecrets) GetEncryptedContent ¶
func (es *EncryptedSecrets) GetEncryptedContent(path string) []string
func (*EncryptedSecrets) RemoveFile ¶
func (es *EncryptedSecrets) RemoveFile(f EncryptedSecretFile)
type Option ¶
type Option struct {
// contains filtered or unexported fields
}
func WithConfirmationReader ¶
func WithConfirmationReader(reader util.ConsoleReader) Option
func WithConsoleReader ¶
func WithConsoleReader(reader util.ConsoleReader) Option
func WithConsoleWriter ¶
func WithConsoleWriter(writer util.ConsoleWriter) Option
func WithDetectGitDir ¶
func WithDetectGitDir() Option
func WithGeneratedKeys ¶
func WithGitRepo ¶
func WithKeysFromCurrentProfile ¶
func WithKeysFromCurrentProfile() Option
func WithKeysFromScConfig ¶
func WithPrivateKey ¶
func WithPrivateKeyPath ¶
func WithProfile ¶
func WithPublicKey ¶
func WithPublicKeyPath ¶
func WithWorkDir ¶
Click to show internal directories.
Click to hide internal directories.