Skip to content

Commit

Permalink
Encode non-string values with ValueToString.
Browse files Browse the repository at this point in the history
Remove unused privateKeySizeLimit.
  • Loading branch information
slewsys committed Jan 4, 2024
1 parent 05ec0e4 commit de0505c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
1 change: 0 additions & 1 deletion age/keysource.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
)

const (
privateKeySizeLimit = 1 << 24 // 16 MiB
// SopsAgeKeyEnv can be set as an environment variable with a string list
// of age keys as value.
SopsAgeKeyEnv = "SOPS_AGE_KEY"
Expand Down
14 changes: 3 additions & 11 deletions stores/flatten.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,17 +258,9 @@ func DecodeNonStrings(m map[string]interface{}) error {

// EncodeNonStrings will look for known metadata keys that are not strings and will encode it to strings
func EncodeNonStrings(m map[string]interface{}) {
if v, found := m["mac_only_encrypted"]; found {
if vBool, ok := v.(bool); ok {
m["mac_only_encrypted"] = "false"
if vBool {
m["mac_only_encrypted"] = "true"
}
}
}
if v, found := m["shamir_threshold"]; found {
if vInt, ok := v.(int); ok {
m["shamir_threshold"] = fmt.Sprintf("%d", vInt)
for k, v := range m {
if _, ok := v.(string); !ok {
m[k] = ValueToString(v)
}
}
}

0 comments on commit de0505c

Please sign in to comment.