Skip to content

Commit 5e7c0b6

Browse files
committed
fix(keystore::plugin): not having a lsp cause of formating is weird
Signed-off-by: Caio Rocha de Oliveira <caiorocoli@gmail.com>
1 parent 007e708 commit 5e7c0b6

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

plugin/plugin-interface.go

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"fmt"
99
"os/exec"
1010
"regexp"
11+
"strings"
1112
"time"
1213
)
1314

@@ -28,7 +29,12 @@ type MasterKey struct {
2829
CreationDate time.Time
2930
}
3031

31-
func NewMasterKey(binaryName string, config map[string]any, timeout string, instanceID string) *MasterKey {
32+
func NewMasterKey(
33+
binaryName string,
34+
config map[string]any,
35+
timeout string,
36+
instanceID string,
37+
) *MasterKey {
3238
if instanceID == "" {
3339
instanceID = "default"
3440
}
@@ -56,7 +62,7 @@ func (key *MasterKey) GetEnvPrefix() string {
5662
// e.g, if instanceID is "my-vault", env prefix will be "SOPS_PLUGIN_MY_VAULT_",
5763
// and users can then use env vars like "SOPS_PLUGIN_MY_VAULT_TOKEN
5864
// or "SOPS_PLUGIN_MY_VAULT_KEY" in their plugin implementation.
59-
return SOPS_PLUGIN + strings.ToUpper(normalized) + "_"
65+
return "SOPS_PLUGIN" + strings.ToUpper(normalized) + "_"
6066
}
6167

6268
func (key MasterKey) ToMap() map[string]any {
@@ -99,11 +105,11 @@ func (key *MasterKey) Encrypt(dataKey []byte) error {
99105

100106
func (key *MasterKey) EncryptContext(ctx context.Context, dataKey []byte) error {
101107
req := map[string]any{
102-
"action": "encrypt",
108+
"action": "encrypt",
103109
"instance_id": key.InstanceID,
104-
"env_prefix": key.GetEnvPrefix(),
105-
"config": key.PluginConfig,
106-
"plaintext": dataKey,
110+
"env_prefix": key.GetEnvPrefix(),
111+
"config": key.PluginConfig,
112+
"plaintext": dataKey,
107113
}
108114

109115
if _, ok := ctx.Deadline(); !ok {
@@ -137,11 +143,11 @@ func (key *MasterKey) Decrypt() ([]byte, error) {
137143

138144
func (key *MasterKey) DecryptContext(ctx context.Context) ([]byte, error) {
139145
req := map[string]any{
140-
"action": "decrypt",
141-
"instance_id": key.InstanceID,
146+
"action": "decrypt",
147+
"instance_id": key.InstanceID,
142148
"env_prefix": key.GetEnvPrefix(),
143-
"config": key.PluginConfig,
144-
"ciphertext": key.EncryptedKey,
149+
"config": key.PluginConfig,
150+
"ciphertext": key.EncryptedKey,
145151
}
146152

147153
if _, ok := ctx.Deadline(); !ok {

0 commit comments

Comments
 (0)