Skip to content

Commit

Permalink
fix: rename from publickey to key
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndr13 committed Feb 14, 2024
1 parent f509c39 commit 920b5ab
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
14 changes: 7 additions & 7 deletions secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ func NewSecret(secretFile *SecretFile, driver string, alternative *Call, path []

// SecretFileData describes the generic structure of secret files.
type SecretFileData struct {
Data string `yaml:"data"`
Type string `yaml:"type"`
PublicKey string `yaml:"publickey"`
Data string `yaml:"data"`
Type string `yaml:"type"`
Key string `yaml:"key"`
}

// NewSecretData constructs a [Data] map as it is required for secrets.
Expand All @@ -49,9 +49,9 @@ func NewSecretData(data string, driver string, key string) (*SecretFileData, err
}

return &SecretFileData{
Data: data,
Type: driver,
PublicKey: key,
Data: data,
Type: driver,
Key: key,
}, nil
}

Expand Down Expand Up @@ -143,7 +143,7 @@ func (secret *Secret) attemptCreate(fs afero.Fs, secretPath string) error {
}

// create new Data map which can then be written into the secret file
secretFileData, err := NewSecretData(encryptedData, secret.Driver.Type(), secret.Driver.GetPublicKey())
secretFileData, err := NewSecretData(encryptedData, secret.Driver.Type(), secret.Driver.GetKey())
if err != nil {
return fmt.Errorf("could not create NewSecretData: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion secret/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

type Driver interface {
Type() string
GetPublicKey() string
GetKey() string
Encrypt(data string) (string, error)
// if key is set, use that one for decryption, otherwise use the key set in the driver (if available)
Decrypt(encrypted string, key string) (string, error)
Expand Down
4 changes: 2 additions & 2 deletions secret/driver/aes.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,6 @@ func (driver *Aes) Type() string {
return "aes"
}

func (driver *Aes) GetPublicKey() string {
return "aesIsSymmetricThereIsNoPublicKey"
func (driver *Aes) GetKey() string {
return "aesIsSymmetricThereIsNoKey"
}
2 changes: 1 addition & 1 deletion secret/driver/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,6 @@ func (driver *Azure) Type() string {
return "azurekv"
}

func (driver Azure) GetPublicKey() string {
func (driver Azure) GetKey() string {
return driver.config.KeyId
}
4 changes: 2 additions & 2 deletions secret/driver/base64.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ func (p *Base64) Type() string {
return "base64"
}

func (p *Base64) GetPublicKey() string {
return "base64DoesNotHaveAPublicKey"
func (p *Base64) GetKey() string {
return "base64DoesNotHaveAKey"
}
4 changes: 2 additions & 2 deletions secret/driver/plain.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ func (p Plain) Type() string {
return "plain"
}

func (p Plain) GetPublicKey() string {
return "plainTextDoesntHaveAPublicKey"
func (p Plain) GetKey() string {
return "plainTextDoesntHaveAKey"
}

0 comments on commit 920b5ab

Please sign in to comment.